diff --git a/l10n_es_aeat_mod303/i18n/es.po b/l10n_es_aeat_mod303/i18n/es.po index 1faa1af455e..73a7641d67d 100644 --- a/l10n_es_aeat_mod303/i18n/es.po +++ b/l10n_es_aeat_mod303/i18n/es.po @@ -6,16 +6,16 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-17 10:44+0000\n" -"PO-Revision-Date: 2024-10-12 11:29+0000\n" -"Last-Translator: \"Pedro M. Baeza\" \n" +"POT-Creation-Date: 2025-01-02 11:29+0000\n" +"PO-Revision-Date: 2025-01-02 12:31+0100\n" +"Last-Translator: Emilio Pascual \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.6.2\n" +"X-Generator: Poedit 3.4.4\n" #. module: l10n_es_aeat_mod303 #: model:ir.model.fields,help:l10n_es_aeat_mod303.field_l10n_es_aeat_mod303_report__casilla_46 @@ -309,6 +309,13 @@ msgstr "Compañía" msgid "Company bank account used for the presentation" msgstr "Cuenta bancaria de la compañía usada para la presentación" +#. module: l10n_es_aeat_mod303 +#. odoo-python +#: code:addons/l10n_es_aeat_mod303/models/mod303.py:0 +#, python-format +msgid "Compensation from previous periods" +msgstr "Compensación de períodos previos" + #. module: l10n_es_aeat_mod303 #: model:ir.model.fields,field_description:l10n_es_aeat_mod303.field_l10n_es_aeat_mod303_report__contact_email msgid "Contact Email" @@ -1057,48 +1064,3 @@ msgstr "¿SII voluntario?" #: model:ir.model.fields,field_description:l10n_es_aeat_mod303.field_l10n_es_aeat_mod303_report__has_operation_volume msgid "¿Volumen de operaciones?" msgstr "¿Volumen de operaciones?" - -#~ msgid "SMS Delivery error" -#~ msgstr "SMS de error en la entrega" - -#~ msgid "Number of messages which requires an action" -#~ msgstr "Número de mensajes que requieren una acción" - -#~ msgid "Model" -#~ msgstr "Modelo" - -#~ msgid "Number of unread messages" -#~ msgstr "Número de mensajes no leídos" - -#~ msgid "Unread Messages" -#~ msgstr "Mensajes no leídos" - -#~ msgid "Unread Messages Counter" -#~ msgstr "Contador de mensajes no leídos" - -#~ msgid "Allow posting" -#~ msgstr "Permitir generar asiento" - -#~ msgid "Calculation date" -#~ msgstr "Fecha de cálculo" - -#~ msgid "Contact email" -#~ msgstr "Email de contacto" - -#~ msgid "Followers (Channels)" -#~ msgstr "Seguidores (Canales)" - -#~ msgid "Period type" -#~ msgstr "Tipo de período" - -#~ msgid "Result type" -#~ msgstr "Tipo de resultado" - -#~ msgid "" -#~ "Información adicional - Operaciones realizadas en el ejercicio - Total " -#~ "volumen de operaciones " -#~ "([80]+[81]+[93]+[94]+[83]+[84]+[85]+[86]+[95]+[96]+[97]+[98]-[79]-[99])" -#~ msgstr "" -#~ "Información adicional - Operaciones realizadas en el ejercicio - Total " -#~ "volumen de operaciones " -#~ "([80]+[81]+[93]+[94]+[83]+[84]+[85]+[86]+[95]+[96]+[97]+[98]-[79]-[99])" diff --git a/l10n_es_aeat_mod303/i18n/l10n_es_aeat_mod303.pot b/l10n_es_aeat_mod303/i18n/l10n_es_aeat_mod303.pot index 2074ee9af2f..57fb1d38244 100644 --- a/l10n_es_aeat_mod303/i18n/l10n_es_aeat_mod303.pot +++ b/l10n_es_aeat_mod303/i18n/l10n_es_aeat_mod303.pot @@ -4,8 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 16.0+e\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-01-02 11:29+0000\n" +"PO-Revision-Date: 2025-01-02 11:29+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -294,6 +296,13 @@ msgstr "" msgid "Company bank account used for the presentation" msgstr "" +#. module: l10n_es_aeat_mod303 +#. odoo-python +#: code:addons/l10n_es_aeat_mod303/models/mod303.py:0 +#, python-format +msgid "Compensation from previous periods" +msgstr "" + #. module: l10n_es_aeat_mod303 #: model:ir.model.fields,field_description:l10n_es_aeat_mod303.field_l10n_es_aeat_mod303_report__contact_email msgid "Contact Email" diff --git a/l10n_es_aeat_mod303/models/mod303.py b/l10n_es_aeat_mod303/models/mod303.py index 63d074b0d5d..0b5dfef65a0 100644 --- a/l10n_es_aeat_mod303/models/mod303.py +++ b/l10n_es_aeat_mod303/models/mod303.py @@ -605,6 +605,27 @@ def _get_move_line_domain(self, date_start, date_end, map_line): map_line, ) + def _prepare_regularization_extra_move_lines(self): + """Include behavior for the regularization of the fees to compensate.""" + lines = super()._prepare_regularization_extra_move_lines() + if not (self.result_type in {"I", "G", "U"} and self.cuota_compensar): + return lines + code = ("%s%%" % _ACCOUNT_PATTERN_MAP.get("C", "4700"),) + compensation_account_id = self.env["account.account"].search( + [("code", "=like", code[0]), ("company_id", "=", self.company_id.id)], + limit=1, + ) + lines.append( + { + "name": _("Compensation from previous periods"), + "account_id": compensation_account_id.id, + "partner_id": self.env.ref("l10n_es_aeat.res_partner_aeat").id, + "debit": 0.0, + "credit": self.cuota_compensar, + } + ) + return lines + class L10nEsAeatMod303ReportActivityCode(models.Model): _name = "l10n.es.aeat.mod303.report.activity.code" diff --git a/l10n_es_aeat_mod303/tests/test_l10n_es_aeat_mod303.py b/l10n_es_aeat_mod303/tests/test_l10n_es_aeat_mod303.py index ae59a72f66c..38f68c59ad3 100644 --- a/l10n_es_aeat_mod303/tests/test_l10n_es_aeat_mod303.py +++ b/l10n_es_aeat_mod303/tests/test_l10n_es_aeat_mod303.py @@ -452,6 +452,23 @@ def setUpClass(cls): cls._invoice_sale_create("2017-01-12") sale = cls._invoice_sale_create("2017-01-13") cls._invoice_refund(sale, "2017-01-14") + # Invoices for testing partial compensation + cls.taxes_sale = {"S_IVA21B": (2000, 420)} + cls.taxes_purchase = {"P_IVA21_BC": (500, 105)} + cls._invoice_sale_create("2015-01-01") + cls._invoice_purchase_create("2015-01-01") + cls.taxes_sale = {"S_IVA21B": (100, 21)} + cls.taxes_purchase = {"P_IVA21_BC": (4000, 840)} + cls._invoice_sale_create("2015-04-01") + cls._invoice_purchase_create("2015-04-01") + cls.taxes_sale = {"S_IVA21B": (3000, 630)} + cls.taxes_purchase = {"P_IVA21_BC": (100, 21)} + cls._invoice_sale_create("2015-07-01") + cls._invoice_purchase_create("2015-07-01") + cls.taxes_sale = {"S_IVA21B": (1350, 283.50)} + cls.taxes_purchase = {"P_IVA21_BC": (100, 21)} + cls._invoice_sale_create("2015-10-01") + cls._invoice_purchase_create("2015-10-01") def _check_tax_lines(self): for field, result in iter(self.taxes_result.items()): @@ -617,3 +634,140 @@ def test_model_303_negative_special_case(self): self.model303.date_end = "2020-03-31" self.model303.button_calculate() self._check_tax_lines() + + def test_model_303_partial_compensation(self): + model303_1T = self.env["l10n.es.aeat.mod303.report"].create( + { + "name": "3030000020151", + "company_id": self.company.id, + "company_vat": "1234567890", + "contact_name": "Test owner", + "statement_type": "N", + "support_type": "T", + "contact_phone": "911234455", + "year": 2015, + "period_type": "1T", + "date_start": "2015-01-01", + "date_end": "2015-03-31", + "journal_id": self.journal_misc.id, + } + ) + model303_1T.button_calculate() + model303_1T.button_confirm() + model303_1T.button_post() + # Check move lines from 303 1T 2015 + self.assertRecordValues( + model303_1T.move_id.line_ids.sorted("balance"), + [ + { + "account_id": self.accounts["475000"].id, + "debit": 0.0, + "credit": 315.0, + }, + { + "account_id": self.accounts["472000"].id, + "debit": 0.0, + "credit": 105.0, + }, + { + "account_id": self.accounts["477000"].id, + "debit": 420.0, + "credit": 0.0, + }, + ], + ) + + model303_2T = model303_1T.copy( + { + "name": "3030000020152", + "period_type": "2T", + "date_start": "2015-04-01", + "date_end": "2015-06-30", + } + ) + model303_2T.button_calculate() + model303_2T.button_confirm() + model303_2T.button_post() + account_470 = self.env["account.account"].search( + [("company_id", "=", self.company.id), ("code", "=", "470000")] + ) + # Check move lines from 303 2T 2015 + self.assertRecordValues( + model303_2T.move_id.line_ids.sorted("balance"), + [ + { + "account_id": self.accounts["472000"].id, + "debit": 0.0, + "credit": 840.0, + }, + { + "account_id": self.accounts["477000"].id, + "debit": 21.0, + "credit": 0.0, + }, + {"account_id": account_470.id, "debit": 819.0, "credit": 0.0}, + ], + ) + + model303_3T = model303_1T.copy( + { + "name": "3030000020153", + "period_type": "3T", + "date_start": "2015-07-01", + "date_end": "2015-09-30", + } + ) + model303_3T.button_calculate() + model303_3T.button_confirm() + model303_3T.button_post() + # Check move lines from 303 3T 2015 + self.assertRecordValues( + model303_3T.move_id.line_ids.sorted("balance"), + [ + {"account_id": account_470.id, "debit": 0.0, "credit": 609.0}, + { + "account_id": self.accounts["472000"].id, + "debit": 0.0, + "credit": 21.0, + }, + { + "account_id": self.accounts["477000"].id, + "debit": 630.0, + "credit": 0.0, + }, + ], + ) + + model303_4T = model303_1T.copy( + { + "name": "3030000020154", + "period_type": "4T", + "date_start": "2015-10-01", + "date_end": "2015-12-31", + } + ) + model303_4T.button_calculate() + model303_4T.button_confirm() + model303_4T.button_post() + # Check move lines from 303 4T 2015 + self.assertRecordValues( + model303_4T.move_id.line_ids.sorted("balance"), + [ + {"account_id": account_470.id, "debit": 0.0, "credit": 210.0}, + { + "account_id": self.accounts["475000"].id, + "debit": 0.0, + "credit": 52.5, + }, + { + "account_id": self.accounts["472000"].id, + "debit": 0.0, + "credit": 21.0, + }, + { + "account_id": self.accounts["477000"].id, + "debit": 283.50, + "credit": 0.0, + }, + ], + )