diff --git a/account_payment_order/__manifest__.py b/account_payment_order/__manifest__.py index ec0d6cc48..a8a6cb312 100644 --- a/account_payment_order/__manifest__.py +++ b/account_payment_order/__manifest__.py @@ -8,7 +8,7 @@ { "name": "Account Payment Order", - "version": "14.0.1.0.0", + "version": "14.0.1.0.2", "license": "AGPL-3", "author": "ACSONE SA/NV, " "Therp BV, " diff --git a/account_payment_order/tests/test_payment_order_inbound.py b/account_payment_order/tests/test_payment_order_inbound.py index b3efd9e1d..914a0b57b 100644 --- a/account_payment_order/tests/test_payment_order_inbound.py +++ b/account_payment_order/tests/test_payment_order_inbound.py @@ -14,25 +14,28 @@ class TestPaymentOrderInboundBase(SavepointCase): def setUpClass(cls): self = cls super().setUpClass() + self.env.user.company_id = self.env.ref("base.main_company").id self.inbound_mode = self.env.ref( "account_payment_mode.payment_mode_inbound_dd1" ) - self.invoice_line_account = self.env["account.account"].search( - [ - ( - "user_type_id", - "=", - self.env.ref("account.data_account_type_revenue").id, - ) - ], - limit=1, + self.invoice_line_account = self.env["account.account"].create( + { + "name": "Test account", + "code": "TEST1", + "user_type_id": self.env.ref("account.data_account_type_revenue").id, + } ) self.journal = self.env["account.journal"].search( - [("type", "=", "bank")], limit=1 + [("type", "=", "bank"), ("company_id", "=", self.env.user.company_id.id)], + limit=1, ) self.inbound_mode.variable_journal_ids = self.journal # Make sure no others orders are present - self.domain = [("state", "=", "draft"), ("payment_type", "=", "inbound")] + self.domain = [ + ("state", "=", "draft"), + ("payment_type", "=", "inbound"), + ("company_id", "=", self.env.user.company_id.id), + ] self.payment_order_obj = self.env["account.payment.order"] self.payment_order_obj.search(self.domain).unlink() # Create payment order @@ -62,6 +65,7 @@ class TestPaymentOrderInboundBase(SavepointCase): invoice_line_form.quantity = 1 invoice_line_form.price_unit = 100.0 invoice_line_form.account_id = self.invoice_line_account + invoice_line_form.tax_ids.clear() invoice = invoice_form.save() invoice_form = Form(invoice) invoice_form.payment_mode_id = self.inbound_mode diff --git a/account_payment_order/tests/test_payment_order_outbound.py b/account_payment_order/tests/test_payment_order_outbound.py index e69dfa5c8..50de54b2a 100644 --- a/account_payment_order/tests/test_payment_order_outbound.py +++ b/account_payment_order/tests/test_payment_order_outbound.py @@ -11,22 +11,16 @@ from odoo.tests.common import TransactionCase class TestPaymentOrderOutbound(TransactionCase): def setUp(self): super(TestPaymentOrderOutbound, self).setUp() + self.env.user.company_id = self.env.ref("base.main_company").id self.journal = self.env["account.journal"].search( [("type", "=", "bank")], limit=1 ) - self.invoice_line_account = ( - self.env["account.account"] - .search( - [ - ( - "user_type_id", - "=", - self.env.ref("account.data_account_type_expenses").id, - ) - ], - limit=1, - ) - .id + self.invoice_line_account = self.env["account.account"].create( + { + "name": "Test account", + "code": "TEST1", + "user_type_id": self.env.ref("account.data_account_type_expenses").id, + } ) self.invoice = self._create_supplier_invoice() self.invoice_02 = self._create_supplier_invoice() @@ -35,10 +29,15 @@ class TestPaymentOrderOutbound(TransactionCase): "account_payment_mode.payment_mode_outbound_dd1" ) self.bank_journal = self.env["account.journal"].search( - [("type", "=", "bank")], limit=1 + [("type", "=", "bank"), ("company_id", "=", self.env.user.company_id.id)], + limit=1, ) # Make sure no other payment orders are in the DB - self.domain = [("state", "=", "draft"), ("payment_type", "=", "outbound")] + self.domain = [ + ("state", "=", "draft"), + ("payment_type", "=", "outbound"), + ("company_id", "=", self.env.user.company_id.id), + ] self.env["account.payment.order"].search(self.domain).unlink() def _create_supplier_invoice(self): @@ -58,7 +57,7 @@ class TestPaymentOrderOutbound(TransactionCase): "quantity": 1.0, "price_unit": 100.0, "name": "product that cost 100", - "account_id": self.invoice_line_account, + "account_id": self.invoice_line_account.id, }, ) ],