Skip to content

Commit

Permalink
Merge 78fee36 into 6001fd7
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Martin committed Oct 17, 2019
2 parents 6001fd7 + 78fee36 commit b25855e
Show file tree
Hide file tree
Showing 34 changed files with 975 additions and 121 deletions.
2 changes: 2 additions & 0 deletions l10n_es_aeat/README.rst
Expand Up @@ -99,6 +99,8 @@ Contribudores
* Ainara Galdona
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Abraham Anes <abraham@studio73.es>
* Isaac Gallart <igallart@puntsistemes.es>
* Pedro Ortega <portega@puntsistemes.es>

Maintainer
----------
Expand Down
2 changes: 2 additions & 0 deletions l10n_es_aeat/__manifest__.py
Expand Up @@ -38,6 +38,8 @@
'views/aeat_export_configuration_view.xml',
'views/aeat_tax_code_mapping_view.xml',
'views/account_move_line_view.xml',
'views/account_fiscal_position_view.xml',
'views/res_partner_view.xml',
'views/report_template.xml',
],
'installable': True,
Expand Down
2 changes: 2 additions & 0 deletions l10n_es_aeat/models/__init__.py
Expand Up @@ -2,7 +2,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import res_company
from . import res_partner
from . import res_partner_bank
from . import account_fiscal_position
from . import l10n_es_aeat_map_tax
from . import l10n_es_aeat_map_tax_line
from . import l10n_es_aeat_report
Expand Down
13 changes: 13 additions & 0 deletions l10n_es_aeat/models/account_fiscal_position.py
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from openerp import fields, models


class AccountFiscalPosition(models.Model):
_inherit = "account.fiscal.position"

partner_identification_type = fields.Selection(
selection=[('1', 'National'), ('2', 'Intracom'), ('3', 'Export')],
string="Partner Identification Type",
help="Currently, this field is used for the VAT book and for the SII.",
oldname="sii_partner_identification_type",
)
2 changes: 1 addition & 1 deletion l10n_es_aeat/models/l10n_es_aeat_report.py
Expand Up @@ -367,7 +367,7 @@ def button_open_move(self):
def unlink(self):
if any(item.state not in ['draft', 'cancelled'] for item in self):
raise exceptions.UserError(_("Only reports in 'draft' or "
"'cancelled' state can be removed"))
"'cancelled' state can be removed"))
return super(L10nEsAeatReport, self).unlink()

@api.model
Expand Down
13 changes: 13 additions & 0 deletions l10n_es_aeat/models/res_partner.py
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

simplified_invoice = fields.Boolean(
string="Simplified invoices in SII or VAT book?",
help="Checking this mark, invoices done to this partner will be "
"sent to SII as simplified invoices or export to VAT book.",
oldname="sii_simplified_invoice",
)
15 changes: 15 additions & 0 deletions l10n_es_aeat/views/account_fiscal_position_view.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_account_position_form" model="ir.ui.view">
<field name="name">account.fiscal.position.form.aeat</field>
<field name="model">account.fiscal.position</field>
<field name="inherit_id" ref="account.view_account_position_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='country_group_id']/.." position="after">
<group string="AEAT" name="group_aeat">
<field name="partner_identification_type"/>
</group>
</xpath>
</field>
</record>
</odoo>
12 changes: 12 additions & 0 deletions l10n_es_aeat/views/res_partner_view.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base_vat.view_partner_form" />
<field name="arch" type="xml">
<div name="vat_info" position="after">
<field name="simplified_invoice"/>
</div>
</field>
</record>
</odoo>
2 changes: 1 addition & 1 deletion l10n_es_aeat_sii/__manifest__.py
Expand Up @@ -13,7 +13,7 @@

{
"name": u"Suministro Inmediato de Información en el IVA",
"version": "10.0.3.4.0",
"version": "10.0.3.4.1",
"category": "Accounting & Finance",
"website": "https://odoospain.odoo.com",
"author": "Acysos S.L.,"
Expand Down
4 changes: 0 additions & 4 deletions l10n_es_aeat_sii/models/account_fiscal_position.py
Expand Up @@ -48,7 +48,3 @@ def default_sii_exempt_cause(self):
selection='_get_selection_sii_exempt_cause',
default=default_sii_exempt_cause,
)
sii_partner_identification_type = fields.Selection(
selection=[('1', 'National'), ('2', 'Intracom'), ('3', 'Export')],
string="SII partner Identification Type",
)
14 changes: 7 additions & 7 deletions l10n_es_aeat_sii/models/account_invoice.py
Expand Up @@ -240,7 +240,7 @@ def write(self, vals):
"already registered at the SII. You must cancel "
"the invoice and create a new one with the "
"correct supplier")
)
)
elif 'supplier_invoice_number' in vals:
raise exceptions.Warning(
_("You cannot change the supplier invoice number of "
Expand Down Expand Up @@ -708,12 +708,12 @@ def _sii_check_exceptions(self):
gen_type = self._get_sii_gen_type()
partner = self.partner_id.commercial_partner_id
country_code = self._get_sii_country_code()
if partner.sii_simplified_invoice and self.type[:2] == 'in':
if partner.simplified_invoice and self.type[:2] == 'in':
raise exceptions.Warning(
_("You can't make a supplier simplified invoice.")
)
if ((gen_type != 3 or country_code == 'ES') and
not partner.vat and not partner.sii_simplified_invoice):
not partner.vat and not partner.simplified_invoice):
raise exceptions.Warning(
_("The partner has not a VAT configured.")
)
Expand Down Expand Up @@ -780,7 +780,7 @@ def _get_sii_invoice_dict_out(self, cancel=False):
if not cancel:
# Check if refund type is 'By differences'. Negative amounts!
sign = self._get_sii_sign()
if partner.sii_simplified_invoice:
if partner.simplified_invoice:
tipo_factura = 'R5' if self.type == 'out_refund' else 'F2'
else:
tipo_factura = 'R4' if self.type == 'out_refund' else 'F1'
Expand Down Expand Up @@ -812,7 +812,7 @@ def _get_sii_invoice_dict_out(self, cancel=False):
}
}
exp_dict = inv_dict['FacturaExpedida']
if not partner.sii_simplified_invoice:
if not partner.simplified_invoice:
# Simplified invoices don't have counterpart
exp_dict["Contraparte"] = {
"NombreRazon": partner.name[0:120],
Expand Down Expand Up @@ -874,7 +874,7 @@ def _get_sii_invoice_dict_in(self, cancel=False):
inv_dict['IDFactura']['IDEmisorFactura'].update(
{'NombreRazon': (
self.partner_id.commercial_partner_id.name[0:120]
)}
)}
)
else:
# Check if refund type is 'By differences'. Negative amounts!
Expand Down Expand Up @@ -1267,7 +1267,7 @@ def _get_sii_gen_type(self):
int: 1 (National), 2 (Intracom), 3 (Export)
"""
self.ensure_one()
partner_ident = self.fiscal_position_id.sii_partner_identification_type
partner_ident = self.fiscal_position_id.partner_identification_type
if partner_ident:
res = int(partner_ident)
elif self.fiscal_position_id.name == u'Régimen Intracomunitario':
Expand Down
5 changes: 0 additions & 5 deletions l10n_es_aeat_sii/models/res_partner.py
Expand Up @@ -11,11 +11,6 @@ class ResPartner(models.Model):
sii_enabled = fields.Boolean(
compute="_compute_sii_enabled",
)
sii_simplified_invoice = fields.Boolean(
string="Simplified invoices in SII?",
help="Checking this mark, invoices done to this partner will be "
"sent to SII as simplified invoices."
)

@api.multi
def _compute_sii_enabled(self):
Expand Down
2 changes: 2 additions & 0 deletions l10n_es_aeat_sii/readme/CONTRIBUTORS.rst
Expand Up @@ -11,3 +11,5 @@
* Santi Argüeso - Comunitea S.L. <santi@comunitea.com>
* Angel Moya - PESOL <angel.moya@pesol.es>
* Nacho Muñoz <nacmuro@gmail.com>
* Isaac Gallart <igallart@puntsistemes.es>
* Pedro Ortega <portega@puntsistemes.es>
3 changes: 1 addition & 2 deletions l10n_es_aeat_sii/views/account_fiscal_position_view.xml
Expand Up @@ -7,7 +7,7 @@
<odoo>

<record id="view_account_position_form" model="ir.ui.view">
<field name="name">account.fiscal.position.form</field>
<field name="name">account.fiscal.position.form.sii</field>
<field name="model">account.fiscal.position</field>
<field name="inherit_id" ref="account.view_account_position_form"/>
<field name="arch" type="xml">
Expand All @@ -19,7 +19,6 @@
<field name="sii_registration_key_purchase" attrs="{'invisible': [('sii_active', '!=', True)]}"/>
<field name="sii_no_taxable_cause" attrs="{'invisible': [('sii_active', '!=', True)]}"/>
<field name="sii_exempt_cause" attrs="{'invisible': [('sii_active', '!=', True)]}"/>
<field name="sii_partner_identification_type" attrs="{'invisible': [('sii_active', '!=', True)]}"/>
</group>
</xpath>
</field>
Expand Down
3 changes: 0 additions & 3 deletions l10n_es_aeat_sii/views/res_partner_views.xml
Expand Up @@ -8,9 +8,6 @@
<field name="arch" type="xml">
<div name="vat_info" position="after">
<field name="sii_enabled" invisible="1"/>
<field name="sii_simplified_invoice"
attrs="{'invisible': [('sii_enabled', '=', False)]}"
/>
</div>
</field>
</record>
Expand Down
4 changes: 2 additions & 2 deletions l10n_es_vat_book/__manifest__.py
Expand Up @@ -7,13 +7,12 @@
"author": "PRAXYA, "
"Eficent, "
"Tecnativa, "
"Punt Sistemes, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-spain",
"license": "AGPL-3",
"category": "Accounting",
"depends": [
'account',
'base_vat',
'l10n_es',
'l10n_es_aeat',
'report_xlsx',
Expand All @@ -26,6 +25,7 @@
'views/l10n_es_vat_book_line.xml',
'views/l10n_es_vat_book_tax_summary.xml',
'views/l10n_es_vat_book_summary.xml',
'views/l10n_es_vat_book_map_view.xml',
'report/common_templates.xml',
'report/report_views.xml',
'report/vat_book_invoices_issued.xml',
Expand Down
83 changes: 83 additions & 0 deletions l10n_es_vat_book/data/map_taxes_vat_book.xml
Expand Up @@ -173,4 +173,87 @@
])]"/>
<field name="name">SuministroFactRecibidas No Deducible</field>
</record>

<record id="aeat_vat_book_map_line_SFRETENCIONES" model="l10n.es.aeat.map.tax.line">
<field name="field_number">15</field>
<field name="map_parent_id" ref="aeat_vat_book_map"/>
<field name="tax_ids" eval="[(6, 0, [
ref('l10n_es.account_tax_template_p_irpf1'),
ref('l10n_es.account_tax_template_p_irpf15'),
ref('l10n_es.account_tax_template_p_irpf18'),
ref('l10n_es.account_tax_template_p_irpf19'),
ref('l10n_es.account_tax_template_p_irpf19a'),
ref('l10n_es.account_tax_template_p_irpf195a'),
ref('l10n_es.account_tax_template_p_irpf2'),
ref('l10n_es.account_tax_template_p_irpf20'),
ref('l10n_es.account_tax_template_p_irpf20a'),
ref('l10n_es.account_tax_template_p_irpf21a'),
ref('l10n_es.account_tax_template_p_irpf21p'),
ref('l10n_es.account_tax_template_p_irpf7'),
ref('l10n_es.account_tax_template_p_irpf9'),
ref('l10n_es.account_tax_template_s_irpf1'),
ref('l10n_es.account_tax_template_s_irpf15'),
ref('l10n_es.account_tax_template_s_irpf18'),
ref('l10n_es.account_tax_template_s_irpf19'),
ref('l10n_es.account_tax_template_s_irpf19a'),
ref('l10n_es.account_tax_template_s_irpf195a'),
ref('l10n_es.account_tax_template_s_irpf2'),
ref('l10n_es.account_tax_template_s_irpf20'),
ref('l10n_es.account_tax_template_s_irpf20a'),
ref('l10n_es.account_tax_template_s_irpf21a'),
ref('l10n_es.account_tax_template_s_irpf21'),
ref('l10n_es.account_tax_template_s_irpf7'),
ref('l10n_es.account_tax_template_s_irpf9'),
])]"/>
<field name="name">SuministroFact Retenciones</field>
</record>

<!-- Map Vat Book deductible -->
<record id="aeat_vat_book_map_P_IVA0_ND" model="l10n.es.vat.book.map">
<field name="tax_id" eval="ref('l10n_es.account_tax_template_p_iva0_nd')"/>
<field name="tax_ids" eval="[(6, 0, [
ref('l10n_es.account_tax_template_p_iva21_bc'),
ref('l10n_es.account_tax_template_p_iva21_sc'),
ref('l10n_es.account_tax_template_p_iva21_sp_in'),
ref('l10n_es.account_tax_template_p_iva21_ic_bc'),
ref('l10n_es.account_tax_template_p_iva21_ic_bi'),
ref('l10n_es.account_tax_template_p_iva21_ibc'),
ref('l10n_es.account_tax_template_p_iva21_ibi'),
ref('l10n_es.account_tax_template_p_iva21_sp_ex'),
ref('l10n_es.account_tax_template_p_iva21_bi'),
ref('l10n_es.account_tax_template_p_iva21_isp'),
])]"/>
</record>

<record id="aeat_vat_book_map_P_IVA10_ND" model="l10n.es.vat.book.map">
<field name="tax_id" eval="ref('l10n_es.account_tax_template_p_iva10_nd')"/>
<field name="tax_ids" eval="[(6, 0, [
ref('l10n_es.account_tax_template_p_iva10_bc'),
ref('l10n_es.account_tax_template_p_iva10_sc'),
ref('l10n_es.account_tax_template_p_iva10_sp_in'),
ref('l10n_es.account_tax_template_p_iva10_ic_bc'),
ref('l10n_es.account_tax_template_p_iva10_ic_bi'),
ref('l10n_es.account_tax_template_p_iva10_ibc'),
ref('l10n_es.account_tax_template_p_iva10_ibi'),
ref('l10n_es.account_tax_template_p_iva10_sp_ex'),
ref('l10n_es.account_tax_template_p_iva10_bi'),
ref('l10n_es.account_tax_template_p_iva10_isp'),
])]"/>
</record>

<record id="aeat_vat_book_map_P_IVA4_ND" model="l10n.es.vat.book.map">
<field name="tax_id" eval="ref('l10n_es.account_tax_template_p_iva4_nd')"/>
<field name="tax_ids" eval="[(6, 0, [
ref('l10n_es.account_tax_template_p_iva4_bc'),
ref('l10n_es.account_tax_template_p_iva4_sc'),
ref('l10n_es.account_tax_template_p_iva4_sp_in'),
ref('l10n_es.account_tax_template_p_iva4_ic_bc'),
ref('l10n_es.account_tax_template_p_iva4_ic_bi'),
ref('l10n_es.account_tax_template_p_iva4_ibc'),
ref('l10n_es.account_tax_template_p_iva4_ibi'),
ref('l10n_es.account_tax_template_p_iva4_sp_ex'),
ref('l10n_es.account_tax_template_p_iva4_bi'),
ref('l10n_es.account_tax_template_p_iva4_isp'),
])]"/>
</record>
</odoo>
1 change: 1 addition & 0 deletions l10n_es_vat_book/models/__init__.py
Expand Up @@ -6,3 +6,4 @@
from . import l10n_es_vat_book_line_tax
from . import l10n_es_vat_book_summary
from . import l10n_es_vat_book_tax_summary
from . import l10n_es_vat_book_map

0 comments on commit b25855e

Please sign in to comment.