| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
from odoo import api, SUPERUSER_ID |
| 3 |
|
| 4 |
|
| 5 |
def migrate(cr, version): |
| 6 |
env = api.Environment(cr, SUPERUSER_ID, {}) |
| 7 |
for company in env['res.company'].search([('chart_template', 'like', 'es_%')], order="parent_path"): |
| 8 |
taxes_to_disable = ( |
| 9 |
f'{company.id}_account_tax_template_p_iva5_ic_bc', |
| 10 |
f'{company.id}_account_tax_template_p_iva5_ic_sc', |
| 11 |
f'{company.id}_account_tax_template_p_iva5_ibc', |
| 12 |
f'{company.id}_account_tax_template_p_iva5_isc', |
| 13 |
f'{company.id}_account_tax_template_p_iva5_bc', |
| 14 |
f'{company.id}_account_tax_template_p_iva5_sc', |
| 15 |
f'{company.id}_account_tax_template_p_iva5_nd', |
| 16 |
f'{company.id}_account_tax_template_s_iva5s', |
| 17 |
f'{company.id}_account_tax_template_s_iva5b', |
| 18 |
f'{company.id}_account_tax_template_s_req062', |
| 19 |
f'{company.id}_account_tax_template_p_req062', |
| 20 |
) |
| 21 |
tax_ids = env['ir.model.data'].search([ |
| 22 |
('name', 'in', taxes_to_disable), |
| 23 |
('model', '=', 'account.tax'), |
| 24 |
]).mapped('res_id') |
| 25 |
env['account.tax'].browse(tax_ids).active = False |
| 26 |
env['account.chart.template'].try_loading(company.chart_template, company, force_create=False) |