[FIX] account_chart_update: Handle updated m2m correctly

This commit is contained in:
Pedro M. Baeza
2018-09-21 23:24:53 +02:00
committed by Reyes4711
parent 26ff1f0ffd
commit c5a6eb2bf4
3 changed files with 16 additions and 3 deletions

View File

@@ -422,8 +422,10 @@ class WizardUpdateChartsAccounts(models.TransientModel):
result[key] = expected
elif template[key] != real[key]:
result[key] = template[key]
if isinstance(result.get(key, False), models.Model):
# Avoid to cache recordset references
# Avoid to cache recordset references
if isinstance(real._fields[key], fields.Many2many):
result[key] = [(6, 0, result[key].ids)]
elif isinstance(real._fields[key], fields.Many2one):
result[key] = result[key].id
except KeyError:
pass