Merge lp:~pedro.baeza/account-payment/7.0-account_payment_extension-fix-amount-sign into lp:~account-payment-team/account-payment/7.0

Proposed by Pedro Manuel Baeza
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 103
Merged at revision: 107
Proposed branch: lp:~pedro.baeza/account-payment/7.0-account_payment_extension-fix-amount-sign
Merge into: lp:~account-payment-team/account-payment/7.0
Diff against target: 14 lines (+6/-0)
1 file modified
account_payment_extension/account_payment.py (+6/-0)
To merge this branch: bzr merge lp:~pedro.baeza/account-payment/7.0-account_payment_extension-fix-amount-sign
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no tests Approve
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Approve
Review via email: mp+192373@code.launchpad.net

Description of the change

[FIX] account_payment_extension: Correct sign for amount and amount_currency when adding lines manually in a receivable payment order.

To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_payment_extension/account_payment.py'
2--- account_payment_extension/account_payment.py 2013-09-24 15:15:21 +0000
3+++ account_payment_extension/account_payment.py 2013-10-23 17:35:00 +0000
4@@ -384,4 +384,10 @@
5 if line.name != '/':
6 result['value']['communication'] = result['value']['communication'] + '. ' + line.name
7 result['value']['account_id'] = line.account_id.id
8+ if context.get('order_id'):
9+ payment_order = self.pool.get('payment.order').browse(
10+ cr, uid, context['order_id'], context=context)
11+ if payment_order.type == 'receivable':
12+ result['value']['amount'] *= -1
13+ result['value']['amount_currency'] *= -1
14 return result