[FIX] account_chart_update: Handle updated m2m correctly
This commit is contained in:
parent
768276e964
commit
e206a37bdd
@ -8,7 +8,7 @@
|
||||
{
|
||||
'name': "Detect changes and update the Account Chart from a template",
|
||||
"summary": "Wizard to update a company's account chart from a template",
|
||||
'version': "11.0.1.0.0",
|
||||
'version': "11.0.1.0.1",
|
||||
'author': "Tecnativa, "
|
||||
"BCIM, "
|
||||
"Okia, "
|
||||
|
@ -85,7 +85,7 @@ msgid "Create/Update"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:614
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:616
|
||||
#, python-format
|
||||
msgid "Created account %s."
|
||||
msgstr ""
|
||||
@ -107,19 +107,19 @@ msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:715
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:717
|
||||
#, python-format
|
||||
msgid "Created or updated fiscal position %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:581
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:583
|
||||
#, python-format
|
||||
msgid "Created tax %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:576
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:578
|
||||
#, python-format
|
||||
msgid "Deactivated tax %s."
|
||||
msgstr ""
|
||||
@ -135,7 +135,7 @@ msgid "Determines where the tax is selectable. Note : 'None' means a tax can't b
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:451
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:453
|
||||
#, python-format
|
||||
msgid "Differences in these fields: %s."
|
||||
msgstr ""
|
||||
@ -149,13 +149,13 @@ msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:623
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:625
|
||||
#, python-format
|
||||
msgid "Exception creating account %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:645
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:647
|
||||
#, python-format
|
||||
msgid "Exception writing account %s."
|
||||
msgstr ""
|
||||
@ -264,7 +264,7 @@ msgid "Messages and Errors"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:475
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:477
|
||||
#, python-format
|
||||
msgid "Name or description not found."
|
||||
msgstr ""
|
||||
@ -297,13 +297,13 @@ msgid "Next"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:518
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:520
|
||||
#, python-format
|
||||
msgid "No account found with this code."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:552
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:554
|
||||
#, python-format
|
||||
msgid "No fiscal position found with this name."
|
||||
msgstr ""
|
||||
@ -339,7 +339,7 @@ msgid "Other options"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:668
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:670
|
||||
#, python-format
|
||||
msgid "Post-updated tax %s."
|
||||
msgstr ""
|
||||
@ -390,7 +390,7 @@ msgid "Tax Scope"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:456
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:458
|
||||
#, python-format
|
||||
msgid "Tax is disabled."
|
||||
msgstr ""
|
||||
@ -427,7 +427,7 @@ msgid "This wizard will update your accounts, taxes and fiscal positions accordi
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:502
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:504
|
||||
#, python-format
|
||||
msgid "To deactivate: not in the template"
|
||||
msgstr ""
|
||||
@ -487,7 +487,7 @@ msgid "Update taxes"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:636
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:638
|
||||
#, python-format
|
||||
msgid "Updated account %s."
|
||||
msgstr ""
|
||||
@ -503,7 +503,7 @@ msgid "Updated fiscal positions"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_chart_update
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:589
|
||||
#: code:addons/account_chart_update/wizard/wizard_chart_update.py:591
|
||||
#, python-format
|
||||
msgid "Updated tax %s."
|
||||
msgstr ""
|
||||
|
@ -90,6 +90,12 @@ class TestAccountChartUpdate(common.HttpCase):
|
||||
self.tax_group = self.env['account.tax.group'].create({
|
||||
'name': 'Test tax group',
|
||||
})
|
||||
self.account_tag_1 = self.env['account.account.tag'].create({
|
||||
'name': 'Test account tag 1',
|
||||
})
|
||||
self.account_tag_2 = self.env['account.account.tag'].create({
|
||||
'name': 'Test account tag 2',
|
||||
})
|
||||
self.company = self.env['res.company'].create({
|
||||
'name': 'Test account_chart_update company',
|
||||
'currency_id': self.chart_template.currency_id.id,
|
||||
@ -214,6 +220,9 @@ class TestAccountChartUpdate(common.HttpCase):
|
||||
self.tax_template.tax_group_id = self.tax_group.id
|
||||
self.tax_template.refund_account_id = new_account_tmpl.id
|
||||
self.account_template.name = "Other name"
|
||||
self.account_template.tag_ids = [
|
||||
(6, 0, [self.account_tag_1.id, self.account_tag_2.id]),
|
||||
]
|
||||
self.fp_template.note = "Test note"
|
||||
self.fp_template.account_ids.account_dest_id = new_account_tmpl.id
|
||||
self.fp_template.tax_ids.tax_dest_id = self.tax_template.id
|
||||
@ -239,6 +248,8 @@ class TestAccountChartUpdate(common.HttpCase):
|
||||
self.assertEqual(self.tax.tax_group_id, self.tax_group)
|
||||
self.assertEqual(self.tax.refund_account_id, new_account)
|
||||
self.assertEqual(self.account.name, self.account_template.name)
|
||||
self.assertIn(self.account_tag_1, self.account.tag_ids)
|
||||
self.assertIn(self.account_tag_2, self.account.tag_ids)
|
||||
self.assertEqual(self.fp.note, self.fp_template.note)
|
||||
self.assertEqual(self.fp.account_ids.account_dest_id, new_account)
|
||||
self.assertEqual(self.fp.tax_ids.tax_dest_id, self.tax)
|
||||
|
@ -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
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user