[FIX] account: fix CoA translations load
This patch solves two issues when loading translations from CSV files. 1. If there is a CoA from a custom module that is not available the load fails. 2. If there is an uninstalled CoA in use some of its fields may be missing thus loading values from CSV files may fail. Both issues were observed during upgrades. closes odoo/odoo#129068 X-original-commit: f2b2260683a284801aa0aa55850cfecb4a0ff0e4 Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
This commit is contained in:
@@ -950,7 +950,7 @@ class AccountChartTemplate(models.AbstractModel):
|
||||
else value
|
||||
)
|
||||
for key, value in row.items()
|
||||
if key != 'id' and value != ""
|
||||
if key != 'id' and value != "" and ('@' in key or '/' in key or key in model_fields)
|
||||
}
|
||||
create_added = set()
|
||||
for key, value in row.items():
|
||||
@@ -978,7 +978,8 @@ class AccountChartTemplate(models.AbstractModel):
|
||||
:type companies: Model<res.company>
|
||||
"""
|
||||
langs = langs or [code for code, _name in self.env['res.lang'].get_installed()]
|
||||
companies = companies or self.env['res.company'].search([('chart_template', '!=', False)])
|
||||
available_template_codes = list(self._get_chart_template_mapping(get_all=True))
|
||||
companies = companies or self.env['res.company'].search([('chart_template', 'in', available_template_codes)])
|
||||
|
||||
translation_importer = TranslationImporter(self.env.cr, verbose=False)
|
||||
for chart_template, chart_companies in groupby(companies, lambda c: c.chart_template):
|
||||
|
||||
Reference in New Issue
Block a user