From be6cc1629d9b0241eebcab1d183696223c447b70 Mon Sep 17 00:00:00 2001 From: FernandoRomera Date: Thu, 22 Dec 2022 11:23:08 +0100 Subject: [PATCH 1/3] [IMP] l10n_es_aeat_mod349: pre-commit stuff --- setup/l10n_es_aeat_mod349/odoo/addons/l10n_es_aeat_mod349 | 1 + setup/l10n_es_aeat_mod349/setup.py | 6 ++++++ 2 files changed, 7 insertions(+) create mode 120000 setup/l10n_es_aeat_mod349/odoo/addons/l10n_es_aeat_mod349 create mode 100644 setup/l10n_es_aeat_mod349/setup.py diff --git a/setup/l10n_es_aeat_mod349/odoo/addons/l10n_es_aeat_mod349 b/setup/l10n_es_aeat_mod349/odoo/addons/l10n_es_aeat_mod349 new file mode 120000 index 00000000000..430c29c2e4c --- /dev/null +++ b/setup/l10n_es_aeat_mod349/odoo/addons/l10n_es_aeat_mod349 @@ -0,0 +1 @@ +../../../../l10n_es_aeat_mod349 \ No newline at end of file diff --git a/setup/l10n_es_aeat_mod349/setup.py b/setup/l10n_es_aeat_mod349/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/l10n_es_aeat_mod349/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 220d77624fec0503ddb5d6dd5ff5167ad10a6ff0 Mon Sep 17 00:00:00 2001 From: FernandoRomera Date: Thu, 22 Dec 2022 11:25:31 +0100 Subject: [PATCH 2/3] [16.0][MIG] l10n_es_aeat_mod349: Migration to 16.0 --- l10n_es_aeat_mod349/__manifest__.py | 2 +- l10n_es_aeat_mod349/models/mod349.py | 12 ++++++------ .../tests/test_l10n_es_aeat_mod349.py | 2 +- l10n_es_aeat_mod349/views/account_move_view.xml | 9 ++++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/l10n_es_aeat_mod349/__manifest__.py b/l10n_es_aeat_mod349/__manifest__.py index 28e35b8cde7..d5cf696534c 100644 --- a/l10n_es_aeat_mod349/__manifest__.py +++ b/l10n_es_aeat_mod349/__manifest__.py @@ -9,7 +9,7 @@ { "name": "AEAT modelo 349", - "version": "15.0.1.3.0", + "version": "16.0.1.0.0", "author": "Tecnativa, ForgeFlow, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Localisation/Accounting", diff --git a/l10n_es_aeat_mod349/models/mod349.py b/l10n_es_aeat_mod349/models/mod349.py index 47a842b99c6..a0255a85ee5 100644 --- a/l10n_es_aeat_mod349/models/mod349.py +++ b/l10n_es_aeat_mod349/models/mod349.py @@ -126,8 +126,8 @@ def _create_349_details(self, move_lines): self._create_349_record_detail(move_line) def _create_349_record_detail(self, move_line): - types = move_line.move_id.mapped("line_ids.account_id.internal_type") - sign = 1 if "payable" in types else -1 + types = move_line.move_id.mapped("line_ids.account_id.internal_group") + sign = 1 if "expense" in types else -1 return self.env["l10n.es.aeat.mod349.partner_record_detail"].create( { "report_id": self.id, @@ -137,8 +137,8 @@ def _create_349_record_detail(self, move_line): ) def _create_349_refund_detail(self, move_line): - types = move_line.move_id.mapped("line_ids.account_id.internal_type") - sign = 1 if "receivable" in types else -1 + types = move_line.move_id.mapped("line_ids.account_id.internal_group") + sign = 1 if "income" in types else -1 return self.env["l10n.es.aeat.mod349.partner_refund_detail"].create( { "report_id": self.id, @@ -382,7 +382,7 @@ def calculate(self): self._create_349_invoice_records() self._create_349_refund_records() # Recompute all pending computed fields - self.recompute() + self.flush_recordset() return True def button_recover(self): @@ -427,7 +427,7 @@ def button_confirm(self): """Checks if all the fields of the report are correctly filled""" self._check_names() self._check_report_lines() - return super(Mod349, self).button_confirm() + return super().button_confirm() class Mod349PartnerRecord(models.Model): diff --git a/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py b/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py index d522d22acc7..fcb58d77b7e 100644 --- a/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py +++ b/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py @@ -208,5 +208,5 @@ def test_model_349(self): self.assertTrue(export_to_boe._export_config(model349, export_config)) # Test report printing self.env.ref("l10n_es_aeat_mod349.act_report_aeat_mod349_pdf")._render( - model349.ids + "l10n_es_aeat_mod349.report_l10n_es_mod349_pdf", model349.ids, {} ) diff --git a/l10n_es_aeat_mod349/views/account_move_view.xml b/l10n_es_aeat_mod349/views/account_move_view.xml index c540ca69187..a820ca88450 100644 --- a/l10n_es_aeat_mod349/views/account_move_view.xml +++ b/l10n_es_aeat_mod349/views/account_move_view.xml @@ -3,19 +3,22 @@ account.move - - + From a8b3846f85f041c7005be85766776e77e4227695 Mon Sep 17 00:00:00 2001 From: FernandoRomera Date: Thu, 22 Dec 2022 11:25:31 +0100 Subject: [PATCH 3/3] [16.0][MIG] l10n_es_aeat_mod349: Migration to 16.0 --- l10n_es_aeat_mod349/__manifest__.py | 2 +- l10n_es_aeat_mod349/models/mod349.py | 12 ++++++------ .../tests/test_l10n_es_aeat_mod349.py | 2 +- l10n_es_aeat_mod349/views/account_move_view.xml | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/l10n_es_aeat_mod349/__manifest__.py b/l10n_es_aeat_mod349/__manifest__.py index 28e35b8cde7..d5cf696534c 100644 --- a/l10n_es_aeat_mod349/__manifest__.py +++ b/l10n_es_aeat_mod349/__manifest__.py @@ -9,7 +9,7 @@ { "name": "AEAT modelo 349", - "version": "15.0.1.3.0", + "version": "16.0.1.0.0", "author": "Tecnativa, ForgeFlow, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Localisation/Accounting", diff --git a/l10n_es_aeat_mod349/models/mod349.py b/l10n_es_aeat_mod349/models/mod349.py index 47a842b99c6..4035c3ec807 100644 --- a/l10n_es_aeat_mod349/models/mod349.py +++ b/l10n_es_aeat_mod349/models/mod349.py @@ -126,8 +126,8 @@ def _create_349_details(self, move_lines): self._create_349_record_detail(move_line) def _create_349_record_detail(self, move_line): - types = move_line.move_id.mapped("line_ids.account_id.internal_type") - sign = 1 if "payable" in types else -1 + types = move_line.move_id.mapped("line_ids.account_id.account_type") + sign = 1 if "liability_payable" in types else -1 return self.env["l10n.es.aeat.mod349.partner_record_detail"].create( { "report_id": self.id, @@ -137,8 +137,8 @@ def _create_349_record_detail(self, move_line): ) def _create_349_refund_detail(self, move_line): - types = move_line.move_id.mapped("line_ids.account_id.internal_type") - sign = 1 if "receivable" in types else -1 + types = move_line.move_id.mapped("line_ids.account_id.account_type") + sign = 1 if "asset_receivable" in types else -1 return self.env["l10n.es.aeat.mod349.partner_refund_detail"].create( { "report_id": self.id, @@ -382,7 +382,7 @@ def calculate(self): self._create_349_invoice_records() self._create_349_refund_records() # Recompute all pending computed fields - self.recompute() + self.flush_recordset() return True def button_recover(self): @@ -427,7 +427,7 @@ def button_confirm(self): """Checks if all the fields of the report are correctly filled""" self._check_names() self._check_report_lines() - return super(Mod349, self).button_confirm() + return super().button_confirm() class Mod349PartnerRecord(models.Model): diff --git a/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py b/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py index d522d22acc7..fcb58d77b7e 100644 --- a/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py +++ b/l10n_es_aeat_mod349/tests/test_l10n_es_aeat_mod349.py @@ -208,5 +208,5 @@ def test_model_349(self): self.assertTrue(export_to_boe._export_config(model349, export_config)) # Test report printing self.env.ref("l10n_es_aeat_mod349.act_report_aeat_mod349_pdf")._render( - model349.ids + "l10n_es_aeat_mod349.report_l10n_es_mod349_pdf", model349.ids, {} ) diff --git a/l10n_es_aeat_mod349/views/account_move_view.xml b/l10n_es_aeat_mod349/views/account_move_view.xml index c540ca69187..b271231a7ea 100644 --- a/l10n_es_aeat_mod349/views/account_move_view.xml +++ b/l10n_es_aeat_mod349/views/account_move_view.xml @@ -3,12 +3,11 @@ account.move -