Debian Codegraph @

addons/l10n_ar_withholding/__init__.py

raw
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3 from . import models
4 from . import wizards
5 from . import demo
6
7 import logging
8
9 _logger = logging.getLogger(__name__)
10
11
12 def _l10n_ar_wth_post_init(env):
13 """ Existing companies that have the Argentinean Chart of Accounts set """
14 template_codes = ['ar_ri', 'ar_ex', 'ar_base']
15 ar_companies = env['res.company'].search([('chart_template', 'in', template_codes), ('parent_id', '=', False)])
16 for company in ar_companies:
17 template_code = company.chart_template
18 ChartTemplate = env['account.chart.template'].with_company(company)
19 data = {
20 model: ChartTemplate._parse_csv(template_code, model, module='l10n_ar_withholding')
21 for model in [
22 'account.account',
23 'account.tax.group',
24 'account.tax',
25 ]
26 }
27 ChartTemplate._deref_account_tags(template_code, data['account.tax'])
28 ChartTemplate._pre_reload_data(company, {}, data)
29 ChartTemplate._load_data(data)
30 company.l10n_ar_tax_base_account_id = ChartTemplate.ref('base_tax_account')
31
32 if env.ref('base.module_l10n_ar_withholding').demo:
33 env['account.chart.template']._post_load_demo_data(company)