Skip to content

Commit

Permalink
[IMP] l10n_es_aeat_sii_invoice_summary: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiadavid committed Jun 13, 2022
1 parent ff9ccde commit 3c66f00
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 48 deletions.
1 change: 0 additions & 1 deletion l10n_es_aeat_sii_invoice_summary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2017 FactorLibre - Hugo Santos <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
26 changes: 10 additions & 16 deletions l10n_es_aeat_sii_invoice_summary/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# -*- coding: utf-8 -*-
# © 2017 FactorLibre - Hugo Santos <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Envio de factura simplificada resumen TPV a SII',
'version': '10.0.1.0.0',
'depends': [
'l10n_es_aeat_sii'
],
'category': "Accounting & Finance",
'author': 'FactorLibre,'
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'website': 'https://odoospain.odoo.com',
'data': [
'views/account_invoice_view.xml'
],
'installable': True,
'application': False
"name": "Envio de factura simplificada resumen TPV a SII",
"version": "10.0.1.0.0",
"depends": ["l10n_es_aeat_sii"],
"category": "Accounting & Finance",
"author": "FactorLibre," "Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/l10n-spain",
"data": ["views/account_invoice_view.xml"],
"installable": True,
"application": False,
}
1 change: 0 additions & 1 deletion l10n_es_aeat_sii_invoice_summary/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2017 FactorLibre - Hugo Santos <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account_invoice
46 changes: 21 additions & 25 deletions l10n_es_aeat_sii_invoice_summary/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
# -*- coding: utf-8 -*-
# © 2017 FactorLibre - Hugo Santos <[email protected]>
# © 2018 FactorLibre - Victor Rodrigo <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models


class AccountInvoice(models.Model):
_inherit = 'account.invoice'
_inherit = "account.invoice"

is_invoice_summary = fields.Boolean('Is SII simplified invoice Summary?')
sii_invoice_summary_start = fields.Char(
'SII Invoice Summary: First Invoice')
sii_invoice_summary_end = fields.Char('SII Invoice Summary: Last Invoice')
is_invoice_summary = fields.Boolean("Is SII simplified invoice Summary?")
sii_invoice_summary_start = fields.Char("SII Invoice Summary: First Invoice")
sii_invoice_summary_end = fields.Char("SII Invoice Summary: Last Invoice")

@api.multi
def _get_sii_invoice_dict_out(self, cancel=False):
inv_dict = super(AccountInvoice, self)._get_sii_invoice_dict_out(
cancel=cancel)
if self.is_invoice_summary and \
self.type == 'out_invoice':
tipo_factura = 'F4'
inv_dict = super(AccountInvoice, self)._get_sii_invoice_dict_out(cancel=cancel)
if self.is_invoice_summary and self.type == "out_invoice":
tipo_factura = "F4"
if self.sii_invoice_summary_start:
if self.sii_invoice_summary_start == \
self.sii_invoice_summary_end:
tipo_factura = 'F2'
if self.sii_invoice_summary_start == self.sii_invoice_summary_end:
tipo_factura = "F2"
else:
inv_dict['IDFactura']['NumSerieFacturaEmisor'] =\
self.sii_invoice_summary_start
inv_dict['IDFactura'][
'NumSerieFacturaEmisorResumenFin'] =\
self.sii_invoice_summary_end
if 'FacturaExpedida' in inv_dict:
if 'TipoFactura' in inv_dict['FacturaExpedida']:
inv_dict['FacturaExpedida']['TipoFactura'] = tipo_factura
if tipo_factura == 'F4':
if 'Contraparte' in inv_dict['FacturaExpedida']:
del inv_dict['FacturaExpedida']['Contraparte']
inv_dict["IDFactura"][
"NumSerieFacturaEmisor"
] = self.sii_invoice_summary_start
inv_dict["IDFactura"][
"NumSerieFacturaEmisorResumenFin"
] = self.sii_invoice_summary_end
if "FacturaExpedida" in inv_dict:
if "TipoFactura" in inv_dict["FacturaExpedida"]:
inv_dict["FacturaExpedida"]["TipoFactura"] = tipo_factura
if tipo_factura == "F4":
if "Contraparte" in inv_dict["FacturaExpedida"]:
del inv_dict["FacturaExpedida"]["Contraparte"]
return inv_dict
10 changes: 5 additions & 5 deletions l10n_es_aeat_sii_invoice_summary/views/account_invoice_view.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- © 2018 Victor Rodrigo <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<record id="account_invoice_form_view" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="l10n_es_aeat_sii.invoice_sii_form"/>
<field name="inherit_id" ref="l10n_es_aeat_sii.invoice_sii_form" />
<field name="arch" type="xml">
<field name="sii_description" position="before">
<field name="is_invoice_summary"/>
<field name="sii_invoice_summary_start"/>
<field name="sii_invoice_summary_end"/>
<field name="is_invoice_summary" />
<field name="sii_invoice_summary_start" />
<field name="sii_invoice_summary_end" />
</field>
</field>
</record>
Expand Down
1 change: 1 addition & 0 deletions setup/l10n_es_aeat_sii_invoice_summary/odoo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
6 changes: 6 additions & 0 deletions setup/l10n_es_aeat_sii_invoice_summary/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 3c66f00

Please sign in to comment.