[FIX] account_payment_order: Fix tests

Don't use taxes in invoices to avoid inconsistency across localization settings
Create account instead of relying on environment
This commit is contained in:
João Marques
2021-03-31 11:28:16 +01:00
parent 1df02a5ae7
commit 0ca96bc789
2 changed files with 14 additions and 25 deletions

View File

@@ -18,16 +18,12 @@ class TestPaymentOrderInboundBase(SavepointCase):
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,
),
("company_id", "=", self.env.user.company_id.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"), ("company_id", "=", self.env.user.company_id.id)],
@@ -69,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

View File

@@ -15,20 +15,12 @@ class TestPaymentOrderOutbound(TransactionCase):
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,
),
("company_id", "=", self.env.user.company_id.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()
@@ -65,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,
},
)
],