From 90dc650ce84c0f36555754ff819fcf1bce0f091c Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Fri, 25 Jun 2021 06:24:34 +0000 Subject: [PATCH] [FIX] account: Fix a traceback in account_payment When changing the journal of a payment that has already been saved by one of another company, a traceback will occur because of writeoff lines. This ensures that it will not happen. closes odoo/odoo#72800 X-original-commit: b44a70284c52623061623d4793ffce29ea25487a Signed-off-by: Laurent Smet Signed-off-by: Nicolas Viseur --- addons/account/models/account_payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index dc2407f6b73..37a0bc054bc 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -830,8 +830,8 @@ class AccountPayment(models.Model): for line in writeoff_lines: line_ids_commands.append((2, line.id)) - if writeoff_lines: - line_ids_commands.append((0, 0, line_vals_list[2])) + for extra_line_vals in line_vals_list[2:]: + line_ids_commands.append((0, 0, extra_line_vals)) # Update the existing journal items. # If dealing with multiple write-off lines, they are dropped and a new one is generated.