Odoo18-Base/addons/l10n_ar_withholding/__init__.py

34 lines
1.3 KiB
Python
Raw Permalink Normal View History

2025-01-06 10:57:38 +07:00
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
from . import wizards
from . import demo
import logging
_logger = logging.getLogger(__name__)
def _l10n_ar_wth_post_init(env):
""" Existing companies that have the Argentinean Chart of Accounts set """
template_codes = ['ar_ri', 'ar_ex', 'ar_base']
2025-03-04 12:23:19 +07:00
ar_companies = env['res.company'].search([('chart_template', 'in', template_codes), ('parent_id', '=', False)])
for company in ar_companies:
template_code = company.chart_template
ChartTemplate = env['account.chart.template'].with_company(company)
2025-01-06 10:57:38 +07:00
data = {
2025-03-04 12:23:19 +07:00
model: ChartTemplate._parse_csv(template_code, model, module='l10n_ar_withholding')
2025-01-06 10:57:38 +07:00
for model in [
'account.account',
'account.tax.group',
'account.tax',
]
}
2025-03-04 12:23:19 +07:00
ChartTemplate._deref_account_tags(template_code, data['account.tax'])
ChartTemplate._pre_reload_data(company, {}, data)
ChartTemplate._load_data(data)
company.l10n_ar_tax_base_account_id = ChartTemplate.ref('base_tax_account')
2025-01-06 10:57:38 +07:00
2025-03-04 12:23:19 +07:00
if env.ref('base.module_l10n_ar_withholding').demo:
env['account.chart.template']._post_load_demo_data(company)