diff options
| author | jbw-odoo <jbw@odoo.com> | 2025-02-04 07:38:52 +0000 |
|---|---|---|
| committer | jbw-odoo <jbw@odoo.com> | 2025-02-05 12:54:41 +0000 |
| commit | 3757daca84dc080a276c04f310262a3ddf340a0f (patch) | |
| tree | f3cdf44daf0e4476318f9fc1b8ad549e09e5ec71 | |
| parent | ca5139046d46c858bca6066566bdb8eda9c766d8 (diff) | |
[FIX] l10n_es_edi_facturae: fix update from 16
Tax account_tax_template_s_iva0_g_i was added in 17.0.
Init hook will load the data from account.tax-es_common.csv (_l10n_es_edi_facturae_post_init_hook) when upgrading from 16.0 and fail because account_tax_template_s_iva0_g_i does not exists yet.
This fix adds filtering on existing taxes in _get_es_facturae_account_taxt()
Runbot error: https://runbot.odoo.com/odoo/runbot.build.error/114680
closes odoo/odoo#196522
X-original-commit: 4df2571c7a76589a1c09f0384018dcb3de6e60d1
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
| -rw-r--r-- | addons/l10n_es_edi_facturae/models/account_chart_template.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/l10n_es_edi_facturae/models/account_chart_template.py b/addons/l10n_es_edi_facturae/models/account_chart_template.py index cb1523e69ff..af99dfcd993 100644 --- a/addons/l10n_es_edi_facturae/models/account_chart_template.py +++ b/addons/l10n_es_edi_facturae/models/account_chart_template.py @@ -7,4 +7,11 @@ class AccountChartTemplate(models.AbstractModel): @template('es_common', 'account.tax') def _get_es_facturae_account_tax(self): - return self._parse_csv('es_common', 'account.tax', module='l10n_es_edi_facturae') + taxes = self._parse_csv('es_common', 'account.tax', module='l10n_es_edi_facturae') + # only return existing taxes + taxes = { + key: value + for key, value in taxes.items() + if self.env['account.chart.template'].ref(key, raise_if_not_found=False) + } + return taxes |
