From a8333b8142a753ba8564e37512eb7fb4e21c3309 Mon Sep 17 00:00:00 2001
From: "Omar (Comunitea)" <omar@comunitea.com>
Date: Mon, 19 Sep 2022 16:41:50 +0000
Subject: [PATCH] =?UTF-8?q?[IMP]=20l10n=5Fes:=20Add=20taxes=20for=20'ISP?=
 =?UTF-8?q?=20Bienes=20de=20Inversi=C3=B3n'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

closes odoo/odoo#98021

Signed-off-by: Josse Colpaert <jco@odoo.com>
---
 .../account_fiscal_position_template_data.xml |   6 +-
 addons/l10n_es/data/account_tax_data.xml      | 151 ++++++++++++++++++
 2 files changed, 154 insertions(+), 3 deletions(-)

diff --git a/addons/l10n_es/data/account_fiscal_position_template_data.xml b/addons/l10n_es/data/account_fiscal_position_template_data.xml
index 61f786ff38b1..c5f78068a097 100644
--- a/addons/l10n_es/data/account_fiscal_position_template_data.xml
+++ b/addons/l10n_es/data/account_fiscal_position_template_data.xml
@@ -3574,7 +3574,7 @@
         <record id="fptt_ispn_p_iva4_bi" model="account.fiscal.position.tax.template">
             <field name="position_id" ref="fp_ispn"/>
             <field name="tax_src_id" ref="account_tax_template_p_iva4_bi"/>
-            <field name="tax_dest_id" ref="account_tax_template_p_iva4_isp"/>
+            <field name="tax_dest_id" ref="account_tax_template_p_iva4_isp_bi"/>
         </record>
         <record id="fptt_ispn_p_iva10_bc" model="account.fiscal.position.tax.template">
             <field name="position_id" ref="fp_ispn"/>
@@ -3589,7 +3589,7 @@
         <record id="fptt_ispn_p_iva10_bi" model="account.fiscal.position.tax.template">
             <field name="position_id" ref="fp_ispn"/>
             <field name="tax_src_id" ref="account_tax_template_p_iva10_bi"/>
-            <field name="tax_dest_id" ref="account_tax_template_p_iva10_isp"/>
+            <field name="tax_dest_id" ref="account_tax_template_p_iva10_isp_bi"/>
         </record>
         <record id="fptt_ispn_p_iva21_bc" model="account.fiscal.position.tax.template">
             <field name="position_id" ref="fp_ispn"/>
@@ -3604,7 +3604,7 @@
         <record id="fptt_ispn_p_iva21_bi" model="account.fiscal.position.tax.template">
             <field name="position_id" ref="fp_ispn"/>
             <field name="tax_src_id" ref="account_tax_template_p_iva21_bi"/>
-            <field name="tax_dest_id" ref="account_tax_template_p_iva21_isp"/>
+            <field name="tax_dest_id" ref="account_tax_template_p_iva21_isp_bi"/>
         </record>
         <record id="fptt_ispn_s_iva4b" model="account.fiscal.position.tax.template">
             <field name="position_id" ref="fp_ispn"/>
diff --git a/addons/l10n_es/data/account_tax_data.xml b/addons/l10n_es/data/account_tax_data.xml
index 4c02d9761844..a384adaf0248 100644
--- a/addons/l10n_es/data/account_tax_data.xml
+++ b/addons/l10n_es/data/account_tax_data.xml
@@ -9,6 +9,7 @@
      © 2015 Vicent Cubells
      © 2013-2020 Pedro M. Baeza
      © 2020 Harald Panten - Sygel Technology
+     © 2022 Omar Castiñeira - Comunitea
      License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
 <odoo>
 
@@ -3875,6 +3876,156 @@
             }),
         ]"/>
     </record>
+    <record id="account_tax_template_p_iva4_isp_bi" model="account.tax.template">
+        <field name="name">IVA 4% ISP (bienes de inversión)</field>
+        <field name="type_tax_use">purchase</field>
+        <field name="amount_type">percent</field>
+        <field name="amount" eval="4"/>
+        <field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
+        <field name="tax_group_id" ref="tax_group_iva_4"/>
+        <field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'base',
+                'tag_ids': [ref('mod_303_30'), ref('mod_303_12')],
+            }),
+
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_472'),
+                'tag_ids': [ref('mod_303_31')],
+            }),
+
+            (0,0, {
+                'factor_percent': -100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_477'),
+                'tag_ids': [ref('mod_303_13')],
+            }),
+        ]"/>
+        <field name="refund_repartition_line_ids" eval="[(5, 0, 0),
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'base',
+                'tag_ids': [ref('mod_303_40'), ref('mod_303_14_purchase')],
+            }),
+
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_472'),
+                'tag_ids': [ref('mod_303_41')],
+            }),
+
+            (0,0, {
+                'factor_percent': -100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_477'),
+                'tag_ids': [ref('mod_303_15')],
+            }),
+        ]"/>
+    </record>
+    <record id="account_tax_template_p_iva10_isp_bi" model="account.tax.template">
+        <field name="name">IVA 10% ISP (bienes de inversión)</field>
+        <field name="type_tax_use">purchase</field>
+        <field name="amount_type">percent</field>
+        <field name="amount" eval="10"/>
+        <field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
+        <field name="tax_group_id" ref="tax_group_iva_10"/>
+        <field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'base',
+                'tag_ids': [ref('mod_303_30'), ref('mod_303_12')],
+            }),
+
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_472'),
+                'tag_ids': [ref('mod_303_31')],
+            }),
+
+            (0,0, {
+                'factor_percent': -100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_477'),
+                'tag_ids': [ref('mod_303_13')],
+            }),
+        ]"/>
+        <field name="refund_repartition_line_ids" eval="[(5, 0, 0),
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'base',
+                'tag_ids': [ref('mod_303_40'), ref('mod_303_14_purchase')],
+            }),
+
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_472'),
+                'tag_ids': [ref('mod_303_41')],
+            }),
+
+            (0,0, {
+                'factor_percent': -100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_477'),
+                'tag_ids': [ref('mod_303_15')],
+            }),
+        ]"/>
+    </record>
+    <record id="account_tax_template_p_iva21_isp_bi" model="account.tax.template">
+        <field name="name">IVA 21% ISP (bienes de inversión)</field>
+        <field name="type_tax_use">purchase</field>
+        <field name="amount_type">percent</field>
+        <field name="amount" eval="21"/>
+        <field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
+        <field name="tax_group_id" ref="tax_group_iva_21"/>
+        <field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'base',
+                'tag_ids': [ref('mod_303_30'), ref('mod_303_12')],
+            }),
+
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_472'),
+                'tag_ids': [ref('mod_303_31')],
+            }),
+
+            (0,0, {
+                'factor_percent': -100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_477'),
+                'tag_ids': [ref('mod_303_13')],
+            }),
+        ]"/>
+        <field name="refund_repartition_line_ids" eval="[(5, 0, 0),
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'base',
+                'tag_ids': [ref('mod_303_40'), ref('mod_303_14_purchase')],
+            }),
+
+            (0,0, {
+                'factor_percent': 100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_472'),
+                'tag_ids': [ref('mod_303_41')],
+            }),
+
+            (0,0, {
+                'factor_percent': -100,
+                'repartition_type': 'tax',
+                'account_id': ref('l10n_es.account_common_477'),
+                'tag_ids': [ref('mod_303_15')],
+            }),
+        ]"/>
+    </record>
     <record id="account_tax_template_p_rp19" model="account.tax.template">
         <field name="type_tax_use">purchase</field>
         <field name="description"/> <!-- for resetting the value on existing DBs -->
-- 
GitLab