From 951dee23bbc42dd92105b0873f6a9bbcf0491bd9 Mon Sep 17 00:00:00 2001
From: Josse Colpaert <jco@odoo.com>
Date: Mon, 11 Sep 2023 16:34:22 +0200
Subject: [PATCH] [FIX] l10n_es_edi_sii: bien inversion should be properly set
 for sii info

The SII module adds some fields on the taxes, so after installing
the module, those fields need to be set on the already installed CoAs.

We forgot to set the l10n_es_bien_inversion field, which is used in
l10n_es_edi_sii to send the right information about the taxes to the gov.

closes odoo/odoo#135484

X-original-commit: 1b37eaaf832cf3edeea3c6665036bdad4b688c27
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
---
 addons/l10n_es_edi_sii/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/addons/l10n_es_edi_sii/__init__.py b/addons/l10n_es_edi_sii/__init__.py
index 5e6da38df550..3f55d4bb4eaf 100644
--- a/addons/l10n_es_edi_sii/__init__.py
+++ b/addons/l10n_es_edi_sii/__init__.py
@@ -17,10 +17,11 @@ def _l10n_es_edi_post_init(cr, registry):
     if all_chart_templates:
         tax_templates = env['account.tax.template'].search([
             ('chart_template_id', 'in', all_chart_templates.ids),
-            '|', '|',
+            '|', '|', '|',
             ('l10n_es_type', '!=', False),
             ('l10n_es_exempt_reason', '!=', False),
             ('tax_scope', '!=', False),
+            ('l10n_es_bien_inversion', '!=', False),
         ])
         xml_ids = tax_templates.get_external_id()
         for company in companies:
@@ -32,4 +33,5 @@ def _l10n_es_edi_post_init(cr, registry):
                         'l10n_es_exempt_reason': tax_template.l10n_es_exempt_reason,
                         'tax_scope': tax_template.tax_scope,
                         'l10n_es_type': tax_template.l10n_es_type,
+                        'l10n_es_bien_inversion': tax_template.l10n_es_bien_inversion,
                     })
-- 
GitLab