Added fields to tax when using account_es from core

This commit is contained in:
Sergio Morillo 2022-07-15 21:16:06 +02:00
parent 61689ee285
commit b8c3b39a8b
3 changed files with 43 additions and 4 deletions

View File

@ -4,6 +4,7 @@ from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.tools import cached_property
from .aeat import (BOOK_KEY, OPERATION_KEY, SEND_SPECIAL_REGIME_KEY,
RECEIVE_SPECIAL_REGIME_KEY, IVA_SUBJECTED, EXEMPTION_CAUSE,
IVA_NOT_SUBJECTED)
@ -114,6 +115,17 @@ class Tax(metaclass=PoolMeta):
sii_exemption_cause = fields.Selection(EXEMPTION_CAUSE, 'Exemption Cause')
tax_used = fields.Boolean('Used in Tax')
invoice_used = fields.Boolean('Used in invoice Total')
recargo_equivalencia = fields.Boolean('Recargo Equivalencia',
help='Indicates if the tax is Recargo de Equivalencia')
recargo_equivalencia_related_tax = fields.Many2One(
'account.tax', 'Recargo Equivalencia Related Tax',
domain=[
('recargo_equivalencia', '=', True),
('company', '=', Eval('company', -1)),
], depends=['recargo_equivalencia', 'company'],
help='The possible Recargo Equivalencia related to this tax')
deducible = fields.Boolean('Deducible',
help='Indicates if the tax is deductible')
@classmethod
def __register__(cls, module_name):
@ -134,3 +146,7 @@ class Tax(metaclass=PoolMeta):
if exist_sii_intracomunity_key:
table.drop_column('sii_intracomunity_key')
@staticmethod
def default_deducible():
return True

View File

@ -2,7 +2,15 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data depends="account_es">
<data>
<!-- Tax view-->
<record model="ir.ui.view" id="tax_form_view">
<field name="model">account.tax</field>
<field name="inherit" ref="account.tax_view_form"/>
<field name="name">tax_form_core</field>
</record>
<!-- Taxes -->
<record model="account.tax.template" id="account_es.iva_sop_21_normal">
<field name="sii_book_key">R</field>
<field name="sii_received_key">01</field>
@ -121,15 +129,16 @@ this repository contains the full copyright notices and license terms. -->
<record model="account.tax.template" id="account_es.iva_sop_intracomunitario_servicios_1_normal">
<field name="sii_book_key">R</field>
<field name="sii_received_key">09</field>
<field name="sii_exemption_cause">E6</field>
<field name="tax_used" eval="False"/>
<field name="sii_subjected_key">S1</field>
<field name="sii_exemption_cause"></field>
<field name="tax_used" eval="True"/>
<field name="invoice_used" eval="True"/>
</record>
<record model="account.tax.template" id="account_es.iva_sop_intracomunitario_servicios_2_normal">
<field name="sii_book_key">R</field>
<field name="sii_received_key">09</field>
<field name="sii_subjected_key">S1</field>
<field name="tax_used" eval="True"/>
<field name="tax_used" eval="False"/>
<field name="invoice_used" eval="True"/>
</record>
<record model="account.tax.template" id="account_es.iva_sop_intracomunitario_inv_1_normal">

14
view/tax_form_core.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--The COPYRIGHT file at the top level of this repository
contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook/page[@id='general']/field[@name='update_unit_price']"
position="after">
<label name="deducible"/>
<field name="deducible"/>
<label name="recargo_equivalencia"/>
<field name="recargo_equivalencia"/>
<label name="recargo_equivalencia_related_tax"/>
<field name="recargo_equivalencia_related_tax"/>
</xpath>
</data>