Skip to content

Commit e2fc005

Browse files
committedMar 12, 2025
[FIX] account_payment_pro: Fix incorrect selected debt when paying with Pay Now in a different currency
1 parent de5d4cc commit e2fc005

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎account_payment_pro/models/account_payment.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,13 @@ def action_post_and_new(self):
506506
def _compute_selected_debt(self):
507507
for rec in self:
508508
# factor = 1
509-
rec.selected_debt = sum(rec.to_pay_move_line_ids._origin.mapped("amount_residual")) * (
510-
-1.0 if rec.partner_type == "supplier" else 1.0
511-
)
509+
amount_residual = sum(rec.to_pay_move_line_ids._origin.mapped("amount_residual"))
510+
if self.env.context.get("pay_now") and amount_residual != sum(
511+
rec.to_pay_move_line_ids._origin.mapped("amount_residual_currency")
512+
):
513+
amount_residual = sum(rec.to_pay_move_line_ids._origin.mapped("amount_residual_currency"))
514+
rec.selected_debt = amount_residual * (-1.0 if rec.partner_type == "supplier" else 1.0)
515+
512516
# TODO error en la creacion de un payment desde el menu?
513517
# if rec.payment_type == 'outbound' and rec.partner_type == 'customer' or \
514518
# rec.payment_type == 'inbound' and rec.partner_type == 'supplier':

0 commit comments

Comments
 (0)