[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) <bib@odoo.com>
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
This commit is contained in:
oco-odoo
2024-04-03 10:48:16 +00:00
parent 5623332815
commit edd0c74b18
+1 -1
View File
@@ -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 = {