From 697d1e515082e51de4ff9563144d1f4c9699367a Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Thu, 10 Aug 2023 09:58:31 +0200 Subject: [PATCH] [MIG] shopinvader_invoice -> shopinvader_restapi_invoice: Migration to 16.0 --- .pre-commit-config.yaml | 1 - .../odoo/addons/shopinvader_restapi_invoice | 1 + setup/shopinvader_restapi_invoice/setup.py | 6 ++++ .../README.rst | 0 .../__init__.py | 0 .../__manifest__.py | 10 +++--- .../i18n/shopinvader_invoice.pot | 0 .../readme/CONTRIBUTORS.rst | 0 .../readme/DESCRIPTION.rst | 0 .../services/__init__.py | 0 .../services/invoice.py | 0 .../static/description/index.html | 0 .../tests/__init__.py | 0 .../tests/common.py | 34 +++++++++---------- .../tests/test_invoice_service.py | 1 - 15 files changed, 29 insertions(+), 24 deletions(-) create mode 120000 setup/shopinvader_restapi_invoice/odoo/addons/shopinvader_restapi_invoice create mode 100644 setup/shopinvader_restapi_invoice/setup.py rename {shopinvader_invoice => shopinvader_restapi_invoice}/README.rst (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/__init__.py (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/__manifest__.py (60%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/i18n/shopinvader_invoice.pot (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/readme/CONTRIBUTORS.rst (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/readme/DESCRIPTION.rst (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/services/__init__.py (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/services/invoice.py (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/static/description/index.html (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/tests/__init__.py (100%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/tests/common.py (86%) rename {shopinvader_invoice => shopinvader_restapi_invoice}/tests/test_invoice_service.py (99%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9b585336f4..148becad9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,6 @@ exclude: | ^shopinvader_elasticsearch/| ^shopinvader_guest_mode/| ^shopinvader_import_image/| - ^shopinvader_invoice/| ^shopinvader_lead/| ^shopinvader_locomotive/| ^shopinvader_locomotive_algolia/| diff --git a/setup/shopinvader_restapi_invoice/odoo/addons/shopinvader_restapi_invoice b/setup/shopinvader_restapi_invoice/odoo/addons/shopinvader_restapi_invoice new file mode 120000 index 0000000000..3af81eeddb --- /dev/null +++ b/setup/shopinvader_restapi_invoice/odoo/addons/shopinvader_restapi_invoice @@ -0,0 +1 @@ +../../../../shopinvader_restapi_invoice \ No newline at end of file diff --git a/setup/shopinvader_restapi_invoice/setup.py b/setup/shopinvader_restapi_invoice/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_restapi_invoice/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shopinvader_invoice/README.rst b/shopinvader_restapi_invoice/README.rst similarity index 100% rename from shopinvader_invoice/README.rst rename to shopinvader_restapi_invoice/README.rst diff --git a/shopinvader_invoice/__init__.py b/shopinvader_restapi_invoice/__init__.py similarity index 100% rename from shopinvader_invoice/__init__.py rename to shopinvader_restapi_invoice/__init__.py diff --git a/shopinvader_invoice/__manifest__.py b/shopinvader_restapi_invoice/__manifest__.py similarity index 60% rename from shopinvader_invoice/__manifest__.py rename to shopinvader_restapi_invoice/__manifest__.py index 72a13d48f2..13013c9d3b 100644 --- a/shopinvader_invoice/__manifest__.py +++ b/shopinvader_restapi_invoice/__manifest__.py @@ -1,15 +1,15 @@ # Copyright 2019 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - "name": "Shopinvader Invoice", - "summary": """Shopinvader Invoice module""", + "name": "Shopinvader Restapi Invoice", + "summary": """Shopinvader Restapi Invoice module""", "author": "ACSONE SA/NV", "website": "https://github.com/shopinvader/odoo-shopinvader", "category": "shopinvader", - "version": "14.0.2.2.0", + "version": "16.0.1.0.0", "license": "AGPL-3", - "depends": ["account", "shopinvader"], + "depends": ["account", "shopinvader_restapi"], "data": [], "demo": [], - "installable": False, + "installable": True, } diff --git a/shopinvader_invoice/i18n/shopinvader_invoice.pot b/shopinvader_restapi_invoice/i18n/shopinvader_invoice.pot similarity index 100% rename from shopinvader_invoice/i18n/shopinvader_invoice.pot rename to shopinvader_restapi_invoice/i18n/shopinvader_invoice.pot diff --git a/shopinvader_invoice/readme/CONTRIBUTORS.rst b/shopinvader_restapi_invoice/readme/CONTRIBUTORS.rst similarity index 100% rename from shopinvader_invoice/readme/CONTRIBUTORS.rst rename to shopinvader_restapi_invoice/readme/CONTRIBUTORS.rst diff --git a/shopinvader_invoice/readme/DESCRIPTION.rst b/shopinvader_restapi_invoice/readme/DESCRIPTION.rst similarity index 100% rename from shopinvader_invoice/readme/DESCRIPTION.rst rename to shopinvader_restapi_invoice/readme/DESCRIPTION.rst diff --git a/shopinvader_invoice/services/__init__.py b/shopinvader_restapi_invoice/services/__init__.py similarity index 100% rename from shopinvader_invoice/services/__init__.py rename to shopinvader_restapi_invoice/services/__init__.py diff --git a/shopinvader_invoice/services/invoice.py b/shopinvader_restapi_invoice/services/invoice.py similarity index 100% rename from shopinvader_invoice/services/invoice.py rename to shopinvader_restapi_invoice/services/invoice.py diff --git a/shopinvader_invoice/static/description/index.html b/shopinvader_restapi_invoice/static/description/index.html similarity index 100% rename from shopinvader_invoice/static/description/index.html rename to shopinvader_restapi_invoice/static/description/index.html diff --git a/shopinvader_invoice/tests/__init__.py b/shopinvader_restapi_invoice/tests/__init__.py similarity index 100% rename from shopinvader_invoice/tests/__init__.py rename to shopinvader_restapi_invoice/tests/__init__.py diff --git a/shopinvader_invoice/tests/common.py b/shopinvader_restapi_invoice/tests/common.py similarity index 86% rename from shopinvader_invoice/tests/common.py rename to shopinvader_restapi_invoice/tests/common.py index cbc97d1285..f13adfc5c5 100644 --- a/shopinvader_invoice/tests/common.py +++ b/shopinvader_restapi_invoice/tests/common.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields -from odoo.addons.shopinvader.tests.common import CommonCase +from odoo.addons.shopinvader_restapi.tests.common import CommonCase class CommonInvoiceCase(CommonCase): @@ -10,22 +10,23 @@ class CommonInvoiceCase(CommonCase): Common for invoice service """ - def setUp(self, *args, **kwargs): - super(CommonInvoiceCase, self).setUp(*args, **kwargs) - self.invoice_obj = self.env["account.move"] - self.journal_obj = self.env["account.journal"] - self.register_payments_obj = self.env["account.payment.register"] - self.sale = self.env.ref("shopinvader.sale_order_2") - self.partner = self.env.ref("shopinvader.partner_1") - self.partner2 = self.env.ref("shopinvader.partner_2") - self.product = self.env.ref("product.product_product_4") - self.bank_journal_euro = self.journal_obj.create( + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.invoice_obj = cls.env["account.move"] + cls.journal_obj = cls.env["account.journal"] + cls.register_payments_obj = cls.env["account.payment.register"] + cls.sale = cls.env.ref("shopinvader_restapi.sale_order_2") + cls.partner = cls.env.ref("shopinvader_restapi.partner_1") + cls.partner2 = cls.env.ref("shopinvader_restapi.partner_2") + cls.product = cls.env.ref("product.product_product_4") + cls.bank_journal_euro = cls.journal_obj.create( {"name": "Bank", "type": "bank", "code": "BNK67"} ) - self.payment_method_manual_in = self.env.ref( - "account.account_payment_method_manual_in" - ) - self.precision = 2 + cls.precision = 2 + + def setUp(self, *args, **kwargs): + super().setUp(*args, **kwargs) with self.work_on_services(partner=self.partner) as work: self.service = work.component(usage="invoices") with self.work_on_services(partner=self.backend.anonymous_partner_id) as work: @@ -103,12 +104,11 @@ def _make_payment(self, invoice, journal=False, amount=False): :return: bool """ ctx = {"active_model": invoice._name, "active_ids": invoice.ids} - wizard_obj = self.register_payments_obj.with_context(ctx) + wizard_obj = self.register_payments_obj.with_context(**ctx) register_payments = wizard_obj.create( { "payment_date": fields.Date.today(), "journal_id": self.bank_journal_euro.id, - "payment_method_id": self.payment_method_manual_in.id, } ) if journal: diff --git a/shopinvader_invoice/tests/test_invoice_service.py b/shopinvader_restapi_invoice/tests/test_invoice_service.py similarity index 99% rename from shopinvader_invoice/tests/test_invoice_service.py rename to shopinvader_restapi_invoice/tests/test_invoice_service.py index b0721f8b90..236a2309b1 100644 --- a/shopinvader_invoice/tests/test_invoice_service.py +++ b/shopinvader_restapi_invoice/tests/test_invoice_service.py @@ -45,7 +45,6 @@ def _make_payment(self, invoice, journal=False, amount=False): { "payment_date": fields.Date.today(), "journal_id": self.bank_journal_euro.id, - "payment_method_id": self.payment_method_manual_in.id, } ) values = {}