From edd0c74b18c18c195c282d0427ecbf4a2f1a063a Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Wed, 27 Mar 2024 12:19:05 +0000 Subject: [PATCH] [IMP] account: journals: add some context key to allow bypassing the mail alias synchronization This is done together with an enterprise commit in order to avoid creating mail alias automatically on journals imported via FEC files, in France. Indeed, such files could contain journals with different codes but same name, each of which would try creating an alias with the same name, raising an error. OPW 3813584 closes odoo/odoo#160168 X-original-commit: 16c305dd3ceda91a84ae073dc1252891bf7af390 Related: odoo/enterprise#59921 Signed-off-by: Brice Bartoletti (bib) Signed-off-by: Olivier Colson (oco) --- addons/account/models/account_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index a9fddc24301..94b0b9a8f30 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -549,7 +549,7 @@ class AccountJournal(models.Model): result = super(AccountJournal, self).write(vals) # Ensure alias coherency when changing type - if 'type' in vals: + if 'type' in vals and not self._context.get('account_journal_skip_alias_sync'): for journal in self: alias_vals = journal._alias_get_creation_values() alias_vals = {