[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) <jol@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user