Skip to content

Commit

Permalink
[MIG] shopinvader_invoice: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
qgroulard committed Aug 10, 2023
1 parent 5b9fb64 commit 5702759
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ exclude: |
^shopinvader_guest_mode/|
^shopinvader_image/|
^shopinvader_import_image/|
^shopinvader_invoice/|
^shopinvader_lead/|
^shopinvader_locomotive/|
^shopinvader_locomotive_algolia/|
Expand Down
1 change: 1 addition & 0 deletions setup/shopinvader_invoice/odoo/addons/shopinvader_invoice
6 changes: 6 additions & 0 deletions setup/shopinvader_invoice/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
4 changes: 2 additions & 2 deletions shopinvader_invoice/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"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"],
"data": [],
"demo": [],
"installable": False,
"installable": True,
}
39 changes: 19 additions & 20 deletions shopinvader_invoice/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ 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.sale_order_2")
cls.partner = cls.env.ref("shopinvader.partner_1")
cls.partner2 = cls.env.ref("shopinvader.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
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:
self.service_guest = work.component(usage="invoice")
cls.precision = 2
with cls.work_on_services(cls, partner=cls.partner) as work:
cls.service = work.component(usage="invoices")
with cls.work_on_services(
cls, partner=cls.backend.anonymous_partner_id
) as work:
cls.service_guest = work.component(usage="invoice")

def _check_data_content(self, data, invoices):
"""
Expand Down Expand Up @@ -103,12 +103,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:
Expand Down
8 changes: 4 additions & 4 deletions shopinvader_invoice/tests/test_invoice_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@


class TestInvoiceServiceAnonymous(CommonInvoiceCase):
def setUp(self, *args, **kwargs):
super(TestInvoiceServiceAnonymous, self).setUp(*args, **kwargs)
self.partner = self.env.ref("base.res_partner_2").copy()
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner = cls.env.ref("base.res_partner_2").copy()

def test_get_invoice_anonymous(self):
"""
Expand Down Expand Up @@ -45,7 +46,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 = {}
Expand Down

0 comments on commit 5702759

Please sign in to comment.