diff --git a/l10n_es_aeat_sii_pos_summary/i18n/es.po b/l10n_es_aeat_sii_pos_summary/i18n/es.po index 91d5251de6d..62a1e8f3b26 100644 --- a/l10n_es_aeat_sii_pos_summary/i18n/es.po +++ b/l10n_es_aeat_sii_pos_summary/i18n/es.po @@ -19,7 +19,13 @@ msgstr "" #: code:addons/l10n_es_aeat_sii_pos_summary/models/pos_session.py:0 #, python-format msgid "A simplified invoice sequence must be cofigured" -msgstr "" +msgstr "Debe configurarse una secuencia de factura simplificada" + +#. module: l10n_es_aeat_sii_pos_summary +#: code:addons/l10n_es_aeat_sii_pos_summary/models/pos_session.py:0 +#, python-format +msgid "Cannot send any summary to SII. All orders have been invoiced" +msgstr "No se puede enviar resumen al SII. Todo los pedidos se han facturado" #. module: l10n_es_aeat_sii_pos_summary #: model:ir.model.fields.selection,name:l10n_es_aeat_sii_pos_summary.selection__pos_session__sii_state__sent_w_errors diff --git a/l10n_es_aeat_sii_pos_summary/i18n/l10n_es_aeat_sii_pos_summary.pot b/l10n_es_aeat_sii_pos_summary/i18n/l10n_es_aeat_sii_pos_summary.pot index 8858a17529b..48a2a0faf1c 100644 --- a/l10n_es_aeat_sii_pos_summary/i18n/l10n_es_aeat_sii_pos_summary.pot +++ b/l10n_es_aeat_sii_pos_summary/i18n/l10n_es_aeat_sii_pos_summary.pot @@ -21,6 +21,12 @@ msgstr "" msgid "A simplified invoice sequence must be cofigured" msgstr "" +#. module: l10n_es_aeat_sii_pos_summary +#: code:addons/l10n_es_aeat_sii_pos_summary/models/pos_session.py:0 +#, python-format +msgid "Cannot send any summary to SII. All orders have been invoiced" +msgstr "" + #. module: l10n_es_aeat_sii_pos_summary #: model:ir.model.fields.selection,name:l10n_es_aeat_sii_pos_summary.selection__pos_session__sii_state__sent_w_errors msgid "Accepted with errors" diff --git a/l10n_es_aeat_sii_pos_summary/models/account_move.py b/l10n_es_aeat_sii_pos_summary/models/account_move.py index 6e054029a00..d0f0f72f4d4 100644 --- a/l10n_es_aeat_sii_pos_summary/models/account_move.py +++ b/l10n_es_aeat_sii_pos_summary/models/account_move.py @@ -40,4 +40,5 @@ def _get_sii_tax_dict(self, tax_line, tax_lines): tax_dict = super(AccountMove, self)._get_sii_tax_dict(tax_line, tax_lines) if self._context.get("from_pos"): tax_dict["CuotaRepercutida"] = round(tax_dict.pop("CuotaSoportada"), 2) + tax_dict["BaseImponible"] = round(tax_dict.pop("BaseImponible"), 2) return tax_dict diff --git a/l10n_es_aeat_sii_pos_summary/models/pos_session.py b/l10n_es_aeat_sii_pos_summary/models/pos_session.py index 9bdec1ad3fd..9790a0ea50e 100644 --- a/l10n_es_aeat_sii_pos_summary/models/pos_session.py +++ b/l10n_es_aeat_sii_pos_summary/models/pos_session.py @@ -110,6 +110,11 @@ def _other_checks_before_send(self): self.ensure_one() if not self.config_id.l10n_es_simplified_invoice_sequence_id: raise UserError(_("A simplified invoice sequence must be cofigured")) + pos_orders_sorted = self._get_sorted_pos_orders() + if not pos_orders_sorted: + raise UserError( + _("Cannot send any summary to SII. All orders have been invoiced") + ) def _process_send_summary_to_sii(self, modification=False): for session in self: @@ -202,6 +207,11 @@ def _get_sii_summary_dict(self): sum(pos_orders_sorted.mapped("amount_total")), 2 ) tipo_factura = "F4" + # si sólo hay 1 pedido no se puede enviar resumen porque + # el número inicio y fin es el mismo y devuelve error, + # en ese caso lo enviamos como factura simplificada: F2 + if len(pos_orders_sorted) == 1: + tipo_factura = "F2" session_date = move._change_date_format(move.date) if pos_orders_amount_total < 0: raise UserError( @@ -227,6 +237,8 @@ def _get_sii_summary_dict(self): "ImporteTotal": importe_total, }, } + if tipo_factura == "F2": + del orders["IDFactura"]["NumSerieFacturaEmisorResumenFin"] if move.sii_macrodata: orders["FacturaExpedida"].update(Macrodato="S") return orders