From 23afec1b8d631093a7e8b384f85f3c6fe4b45f14 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 5 Mar 2019 17:13:47 +0000 Subject: [PATCH] [FIX] l10n_multilang: avoid module conflicts In case two modules are using the same local name for their external identifier, a conflict may occure. e.g. the templates - l10n_generic_coa.a_salary_expense - l10n_be.a_salary_expense will generate - l10n_generic_coa.1_a_salary_expense - l10n_be.2_a_salary_expense As the previous search for in_xml_ids was using a domain ('name', '=', 'a_salary_expense') both records were returned, making in_ids to have one more record than out_ids Followup of review made at odoo/odoo#31510 closes odoo/odoo#31604 Signed-off-by: Martin Trigaux (mat) --- .../l10n_multilang/models/l10n_multilang.py | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/addons/l10n_multilang/models/l10n_multilang.py b/addons/l10n_multilang/models/l10n_multilang.py index 08ecb01a665..2f6e3731faa 100644 --- a/addons/l10n_multilang/models/l10n_multilang.py +++ b/addons/l10n_multilang/models/l10n_multilang.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from collections import defaultdict import logging from odoo import api, models @@ -88,20 +89,33 @@ class AccountChartTemplate(models.Model): def _get_template_from_model(self, company_id, model): """ Find the records and their matching template """ - # genereated records have an external id with the format _