summaryrefslogtreecommitdiff
path: root/addons/account
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-05-07 12:24:15 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-05-07 12:31:25 +0000
commit86a2819697d5d9d1c32ba902d8a1089acf6110f2 (patch)
tree50a0cb6a9c53915b0a0e92838799e850bb853332 /addons/account
parentfa2fb9f7e3456b576ff981ecdd602f1f8f8d2f5c (diff)
[FIX] account: avoid change of payment type on 0 amount
Create a draft payment with payment type and 0 amount. Save. The payment type will be overwritten opw-2495461 closes odoo/odoo#70603 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Diffstat (limited to 'addons/account')
-rw-r--r--addons/account/models/account_payment.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index 4d9988cf203..46f04073bcd 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -680,12 +680,15 @@ class AccountPayment(models.Model):
})
payment_vals_to_write.update({
'amount': abs(liquidity_amount),
- 'payment_type': 'inbound' if liquidity_amount > 0.0 else 'outbound',
'partner_type': partner_type,
'currency_id': liquidity_lines.currency_id.id,
'destination_account_id': counterpart_lines.account_id.id,
'partner_id': liquidity_lines.partner_id.id,
})
+ if liquidity_amount > 0.0:
+ payment_vals_to_write.update({'payment_type': 'inbound'})
+ elif liquidity_amount < 0.0:
+ payment_vals_to_write.update({'payment_type': 'outbound'})
move.write(move._cleanup_write_orm_values(move, move_vals_to_write))
pay.write(move._cleanup_write_orm_values(pay, payment_vals_to_write))