[IMP] account: allow to set chart_template install priority
When you install a localization with multiple `chart_template`, the first one in alphabetical order is installed by default. This is not always the more relevant configuration. This PR adds an optional `sequence` parameter to `chart_template` that will be used to decide which one will be used when installing localization for the first time. opw-3328807 X-original-commit: ee6408250b13c3ef8160f7f777d9bb8efcaeb37d Part-of: odoo/odoo#126649
This commit is contained in:
@@ -44,6 +44,7 @@ class IrModule(models.Model):
|
||||
fct._l10n_template[0]: {
|
||||
'name': fct(ChartTemplate).get('name'),
|
||||
'parent': fct(ChartTemplate).get('parent'),
|
||||
'sequence': fct(ChartTemplate).get('sequence', 1),
|
||||
'country': fct(ChartTemplate).get('country', ''),
|
||||
'visible': fct(ChartTemplate).get('visible', True),
|
||||
'installed': module.state == "installed",
|
||||
@@ -56,7 +57,7 @@ class IrModule(models.Model):
|
||||
|
||||
module.account_templates = {
|
||||
code: templ(self.env, code, **vals)
|
||||
for code, vals in templates.items()
|
||||
for code, vals in sorted(templates.items(), key=lambda kv: kv[1]['sequence'])
|
||||
}
|
||||
|
||||
def write(self, vals):
|
||||
|
||||
Reference in New Issue
Block a user