[FIX] account: support inherited CoA in tax update script

For companies having a Chart of Accounts that inherits from an ancestor CoA linked to the taxes, the current tax update script did not work.
This change also supports this case.

X-original-commit: 45aae69c20d40467d64af4c7e4f0b45b7832b89c
Part-of: odoo/odoo#110841
This commit is contained in:
Dylan Kiss (dyki)
2023-01-24 16:18:27 +01:00
parent 608faa7d6e
commit a9fefa1988
+2 -2
View File
@@ -157,8 +157,8 @@ def update_taxes_from_templates(cr, chart_template_xmlid):
)
env = api.Environment(cr, SUPERUSER_ID, {})
chart_template_id = env['ir.model.data']._xmlid_to_res_id(chart_template_xmlid)
companies = env['res.company'].search([('chart_template_id', '=', chart_template_id)])
chart_template_id = env.ref(chart_template_xmlid).id
companies = env['res.company'].search([('chart_template_id', 'child_of', chart_template_id)])
outdated_taxes = []
new_taxes_template = []
for company in companies: