From dab9b3d349147d1d6dd452db5fefd352c54a89ca Mon Sep 17 00:00:00 2001 From: "Maximilien (malb)" Date: Tue, 23 May 2023 09:53:14 +0000 Subject: [PATCH] [FIX] account: Error when installing module demo data Before this commit, when trying to install the l10n_sa or l10n_ae localization, we get an error in the chart template resulting in no demo data installed. In fact, when doing a Command.update to link the account to the journal in the files template_sa and template_ae. The "values" dict was always filled no matter the Command, this mistake had repercussion on the "deref" method. In the deref method we do a loop on values items, but in the case we are facing the last_part variable was filled with an integer. When doing the recursion in case command is a "create" or an "update", the new values is the last_part, so the loop on values items raised an error since we cannot do a .items() on an integer. closes odoo/odoo#116643 Related: odoo/upgrade#4687 Signed-off-by: John Laterre (jol) --- addons/account/models/chart_template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 4891e38e4a7..bc515bc498c 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -264,8 +264,9 @@ class AccountChartTemplate(models.AbstractModel): rec = self.ref(xmlid, raise_if_not_found=False) if rec: for fname in x2manyfields: - for i, (line, vals) in enumerate(zip(rec[fname], values[fname])): - values[fname][i] = Command.update(line.id, vals[2]) + for i, (line, (command, _id, vals)) in enumerate(zip(rec[fname], values[fname])): + if command == Command.CREATE: + values[fname][i] = Command.update(line.id, vals) if model_name == 'account.fiscal.position': # Only add tax mappings containing new taxes