diff --git a/l10n_es_aeat_sii_invoice_summary/__init__.py b/l10n_es_aeat_sii_invoice_summary/__init__.py index 84b203f907e..e5b36152f45 100644 --- a/l10n_es_aeat_sii_invoice_summary/__init__.py +++ b/l10n_es_aeat_sii_invoice_summary/__init__.py @@ -1,3 +1,4 @@ # © 2017 FactorLibre - Hugo Santos +# © 2022 ProcessControl - David Ramia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/l10n_es_aeat_sii_invoice_summary/__manifest__.py b/l10n_es_aeat_sii_invoice_summary/__manifest__.py index ccc0c273100..b89a1cb412d 100644 --- a/l10n_es_aeat_sii_invoice_summary/__manifest__.py +++ b/l10n_es_aeat_sii_invoice_summary/__manifest__.py @@ -1,14 +1,17 @@ # © 2017 FactorLibre - Hugo Santos +# © 2022 ProcessControl - David Ramia # 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"], + "version": "14.0.1.0.0", + "depends": [ + "l10n_es_aeat_sii_oca", + ], "category": "Accounting & Finance", - "author": "FactorLibre," "Odoo Community Association (OCA)", + "author": "FactorLibre," "ProcessControl," "Odoo Community Association (OCA)", "license": "AGPL-3", "website": "https://github.com/OCA/l10n-spain", - "data": ["views/account_invoice_view.xml"], + "data": ["views/account_move_view.xml"], "installable": True, "application": False, } diff --git a/l10n_es_aeat_sii_invoice_summary/i18n/es.po b/l10n_es_aeat_sii_invoice_summary/i18n/es.po index b8eef629fea..2313b9542ef 100644 --- a/l10n_es_aeat_sii_invoice_summary/i18n/es.po +++ b/l10n_es_aeat_sii_invoice_summary/i18n/es.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 14.0+e\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-20 12:10+0000\n" -"PO-Revision-Date: 2018-03-20 13:13+0100\n" +"POT-Creation-Date: 2022-05-26 19:46+0000\n" +"PO-Revision-Date: 2022-05-26 21:48+0200\n" "Last-Translator: <>\n" "Language-Team: \n" "Language: es\n" @@ -15,24 +15,81 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" -"X-Generator: Poedit 1.8.7.1\n" +"X-Generator: Poedit 3.0.1\n" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model,name:l10n_es_aeat_sii_invoice_summary.model_account_invoice -msgid "Invoice" -msgstr "Factura" +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__display_name +msgid "Display Name" +msgstr "Nombre mostrado" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_invoice_is_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__id +msgid "ID" +msgstr "ID" + +#. module: l10n_es_aeat_sii_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_bank_statement_line__is_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__is_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_payment__is_invoice_summary msgid "Is SII simplified invoice Summary?" msgstr "Resumen facturas simplificadas SII" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_invoice_sii_invoice_summary_start +#: model:ir.model,name:l10n_es_aeat_sii_invoice_summary.model_account_move +msgid "Journal Entry" +msgstr "Asiento contable" + +#. module: l10n_es_aeat_sii_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move____last_update +msgid "Last Modified on" +msgstr "Modificado por última vez el" + +#. module: l10n_es_aeat_sii_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_bank_statement_line__sii_invoice_summary_start +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__sii_invoice_summary_start +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_payment__sii_invoice_summary_start msgid "SII Invoice Summary: First Invoice" msgstr "Resumen facturas simplificadas SII: Primera factura" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_invoice_sii_invoice_summary_end +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_bank_statement_line__sii_invoice_summary_end +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__sii_invoice_summary_end +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_payment__sii_invoice_summary_end msgid "SII Invoice Summary: Last Invoice" msgstr "Resumen facturas simplificadas SII: Última factura" + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "The partner has not a VAT configured." +msgstr "El cliente no tiene un CIF/NIF configurado." + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "The supplier number invoice is required" +msgstr "El nº de factura del proveedor es obligatorio" + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "This company doesn't have SII enabled." +msgstr "Esta compañía no tiene el SII habilitado." + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "This invoice is not SII enabled." +msgstr "Esta compañía no tiene el SII habilitado." + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "You can't make a supplier simplified invoice." +msgstr "No puede realizar una factura simplificada a un proveedor." + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "You have to select what account chart template use this company." +msgstr "Debe seleccionar el plan de cuentas que está utilizando esta compañía." diff --git a/l10n_es_aeat_sii_invoice_summary/i18n/l10n_es_aeat_sii_invoice_summary.pot b/l10n_es_aeat_sii_invoice_summary/i18n/l10n_es_aeat_sii_invoice_summary.pot index 72fecdd41a6..80abc8b5e20 100644 --- a/l10n_es_aeat_sii_invoice_summary/i18n/l10n_es_aeat_sii_invoice_summary.pot +++ b/l10n_es_aeat_sii_invoice_summary/i18n/l10n_es_aeat_sii_invoice_summary.pot @@ -1,12 +1,14 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * l10n_es_aeat_sii_invoice_summary +# * l10n_es_aeat_sii_invoice_summary # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" +"Project-Id-Version: Odoo Server 14.0+e\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2022-05-26 19:46+0000\n" +"PO-Revision-Date: 2022-05-26 19:46+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -14,22 +16,78 @@ msgstr "" "Plural-Forms: \n" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model,name:l10n_es_aeat_sii_invoice_summary.model_account_invoice -msgid "Invoice" +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__display_name +msgid "Display Name" msgstr "" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_invoice_is_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__id +msgid "ID" +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_bank_statement_line__is_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__is_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_payment__is_invoice_summary msgid "Is SII simplified invoice Summary?" msgstr "" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_invoice_sii_invoice_summary_start +#: model:ir.model,name:l10n_es_aeat_sii_invoice_summary.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move____last_update +msgid "Last Modified on" +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_bank_statement_line__sii_invoice_summary_start +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__sii_invoice_summary_start +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_payment__sii_invoice_summary_start msgid "SII Invoice Summary: First Invoice" msgstr "" #. module: l10n_es_aeat_sii_invoice_summary -#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_invoice_sii_invoice_summary_end +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_bank_statement_line__sii_invoice_summary_end +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_move__sii_invoice_summary_end +#: model:ir.model.fields,field_description:l10n_es_aeat_sii_invoice_summary.field_account_payment__sii_invoice_summary_end msgid "SII Invoice Summary: Last Invoice" msgstr "" +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "The partner has not a VAT configured." +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "The supplier number invoice is required" +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "This company doesn't have SII enabled." +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "This invoice is not SII enabled." +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "You can't make a supplier simplified invoice." +msgstr "" + +#. module: l10n_es_aeat_sii_invoice_summary +#: code:addons/l10n_es_aeat_sii_invoice_summary/models/account_move.py:0 +#, python-format +msgid "You have to select what account chart template use this company." +msgstr "" diff --git a/l10n_es_aeat_sii_invoice_summary/models/__init__.py b/l10n_es_aeat_sii_invoice_summary/models/__init__.py index 720928dcdd3..4b583fc362e 100644 --- a/l10n_es_aeat_sii_invoice_summary/models/__init__.py +++ b/l10n_es_aeat_sii_invoice_summary/models/__init__.py @@ -1,3 +1,4 @@ # © 2017 FactorLibre - Hugo Santos +# © 2022 ProcessControl - David Ramia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import account_invoice +from . import account_move diff --git a/l10n_es_aeat_sii_invoice_summary/models/account_invoice.py b/l10n_es_aeat_sii_invoice_summary/models/account_invoice.py deleted file mode 100644 index 1567a2e4892..00000000000 --- a/l10n_es_aeat_sii_invoice_summary/models/account_invoice.py +++ /dev/null @@ -1,35 +0,0 @@ -# © 2017 FactorLibre - Hugo Santos -# © 2018 FactorLibre - Victor Rodrigo -# 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" - - 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" - if self.sii_invoice_summary_start: - 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"] - return inv_dict diff --git a/l10n_es_aeat_sii_invoice_summary/models/account_move.py b/l10n_es_aeat_sii_invoice_summary/models/account_move.py new file mode 100644 index 00000000000..684871bb57f --- /dev/null +++ b/l10n_es_aeat_sii_invoice_summary/models/account_move.py @@ -0,0 +1,66 @@ +# © 2017 FactorLibre - Hugo Santos +# © 2018 FactorLibre - Victor Rodrigo +# © 2022 ProcessControl - David Ramia +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import _, exceptions, fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + 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") + + def _get_sii_invoice_dict_out(self, cancel=False): + inv_dict = super(AccountMove, self)._get_sii_invoice_dict_out(cancel=cancel) + if self.is_invoice_summary and self.move_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" + 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 "Contraparte" in inv_dict["FacturaExpedida"]: + del inv_dict["FacturaExpedida"]["Contraparte"] + + return inv_dict + + def _sii_check_exceptions(self): + """Inheritable method for exceptions control when sending SII invoices.""" + self.ensure_one() + gen_type = self._get_sii_gen_type() + partner = self._sii_get_partner() + country_code = self._get_sii_country_code() + is_simplified_invoice = self._is_sii_simplified_invoice() + + if is_simplified_invoice and self.move_type[:2] == "in": + raise exceptions.UserError( + _("You can't make a supplier simplified invoice.") + ) + if ( + (gen_type != 3 or country_code == "ES") + and not partner.vat + and not is_simplified_invoice + and not self.is_invoice_summary + ): + raise exceptions.UserError(_("The partner has not a VAT configured.")) + + if not self.company_id.chart_template_id: + raise exceptions.UserError( + _("You have to select what account chart template use this" " company.") + ) + if not self.company_id.sii_enabled: + raise exceptions.UserError(_("This company doesn't have SII enabled.")) + if not self.sii_enabled: + raise exceptions.UserError(_("This invoice is not SII enabled.")) + if not self.ref and self.move_type in ["in_invoice", "in_refund"]: + raise exceptions.UserError(_("The supplier number invoice is required")) diff --git a/l10n_es_aeat_sii_invoice_summary/readme/CONTRIBUTORS.rst b/l10n_es_aeat_sii_invoice_summary/readme/CONTRIBUTORS.rst index 018e3d46150..c248196e252 100644 --- a/l10n_es_aeat_sii_invoice_summary/readme/CONTRIBUTORS.rst +++ b/l10n_es_aeat_sii_invoice_summary/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Hugo Santos (https://factorlibre.com/) * Victor Rodrigo (https://factorlibre.com/) * Omar Castiñeira (https://comunitea.com/) +* David Ramia (https://processcontrol.es) diff --git a/l10n_es_aeat_sii_invoice_summary/views/account_invoice_view.xml b/l10n_es_aeat_sii_invoice_summary/views/account_invoice_view.xml deleted file mode 100644 index 4a5b18d997e..00000000000 --- a/l10n_es_aeat_sii_invoice_summary/views/account_invoice_view.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - account.invoice.form - account.invoice - - - - - - - - - - - diff --git a/l10n_es_aeat_sii_invoice_summary/views/account_move_view.xml b/l10n_es_aeat_sii_invoice_summary/views/account_move_view.xml new file mode 100644 index 00000000000..ea5ccf43ed2 --- /dev/null +++ b/l10n_es_aeat_sii_invoice_summary/views/account_move_view.xml @@ -0,0 +1,24 @@ + + + + + account.move.sii.invoice.summary.form.view + account.move + + + + + + + + + + diff --git a/setup/l10n_es_aeat_sii_invoice_summary/odoo/__init__.py b/setup/l10n_es_aeat_sii_invoice_summary/odoo/__init__.py deleted file mode 100644 index de40ea7ca05..00000000000 --- a/setup/l10n_es_aeat_sii_invoice_summary/odoo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/l10n_es_aeat_sii_invoice_summary/odoo/addons/__init__.py b/setup/l10n_es_aeat_sii_invoice_summary/odoo/addons/__init__.py deleted file mode 100644 index de40ea7ca05..00000000000 --- a/setup/l10n_es_aeat_sii_invoice_summary/odoo/addons/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__)