From c366efa6752995d321f59b395814bf28fb61afc2 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Fri, 12 Jan 2024 16:13:47 +0100 Subject: [PATCH] [FIX] account: traceback on invoice lines update+delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create an Invoice with 2 lines of product Save Delete one Change currency Save Traceback will occur becasue of a ValueError ``` for command, line_id, line_vals in vals['invoice_line_ids'] ValueError: not enough values to unpack (expected 3, got 2) ``` opw-3672799 closes odoo/odoo#149261 Signed-off-by: William André (wan) --- addons/account/models/account_move.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 51cd48f9f45..b006b4c2904 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2393,8 +2393,8 @@ class AccountMove(models.Model): # both fields, sometimes one field can be explicitely empty while the other # one is not, sometimes not... update_vals = { - line_id: line_vals - for command, line_id, line_vals in vals['invoice_line_ids'] + line_id: line_vals[0] + for command, line_id, *line_vals in vals['invoice_line_ids'] if command == Command.UPDATE } for command, line_id, line_vals in vals['line_ids']: @@ -2402,10 +2402,10 @@ class AccountMove(models.Model): line_vals.update(update_vals.pop(line_id)) for line_id, line_vals in update_vals.items(): vals['line_ids'] += [Command.update(line_id, line_vals)] - for command, line_id, line_vals in vals['invoice_line_ids']: + for command, line_id, *line_vals in vals['invoice_line_ids']: assert command not in (Command.SET, Command.CLEAR) - if [command, line_id, line_vals] not in vals['line_ids']: - vals['line_ids'] += [(command, line_id, line_vals)] + if [command, line_id, *line_vals] not in vals['line_ids']: + vals['line_ids'] += [(command, line_id, *line_vals)] del vals['invoice_line_ids'] return vals