[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 <smetl@users.noreply.github.com>
Signed-off-by: Nicolas Viseur <vin-odoo@users.noreply.github.com>
This commit is contained in:
Nicolas (vin)
2021-06-25 13:46:45 +00:00
parent d580c93aa3
commit 90dc650ce8
+2 -2
View File
@@ -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.