Debian Codegraph @

addons/l10n_es_edi_verifactu/__init__.py

raw symbols SCIP
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3 from . import models
4 from . import wizard
5
6
7 def _l10n_es_edi_verifactu_post_init_hook(env):
8 for company in env['res.company'].search([('chart_template', 'like', r'es\_%'), ('parent_id', '=', False)]):
9 Template = env['account.chart.template'].with_company(company)
10 if company.chart_template.startswith("es_canary"):
11 tax_data = Template._get_es_verifactu_account_tax_es_canary_common()
12 else:
13 tax_data = Template._get_es_verifactu_account_tax_es_common_mainland()
14 # Filter out data for non-exsting taxes; else this function will raise.
15 # In case of data for a non-existing tax we would try to create that tax.
16 # This would fail because we don't supply enough information in this module (just `l10n_es_applicability`).
17 tax_data = {
18 xmlid: value
19 for xmlid, value in tax_data.items()
20 if Template.ref(xmlid, raise_if_not_found=False)
21 }
22 Template._load_data({
23 'account.tax': tax_data,
24 })