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 on 2013-10-23
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp on 2014-01-31
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 on 2014-01-31
Maxime Chambreuil (http://www.savoirfairelinux.com) code review 2013-10-23 Approve on 2013-12-27
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.
review: Approve (code review)

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