[IMP] account_payment_order: Remove dependancies on demo data on tests

This commit is contained in:
Enric Tobella
2024-12-23 21:59:18 +01:00
committed by Weblate
parent 687441a673
commit e6093981f4
3 changed files with 31 additions and 4 deletions

View File

@@ -15,6 +15,21 @@ class TestBank(TransactionCase):
def test_bank(self):
bank = self.env["res.bank"].search([], limit=1)
self.assertTrue(bank)
if not bank:
# This should only happen if we don't have demo data
bank = (
self.env["res.bank"]
.env["res.bank"]
.create(
{
"name": "Fiducial Banque",
"bic": "FIDCFR21XXX",
"street": "38 rue Sergent Michel Berthet",
"zip": "69009",
"city": "Lyon",
"country": self.env.ref("base.fr").id,
}
)
)
with self.assertRaises(ValidationError):
bank.bic = "TEST"

View File

@@ -23,6 +23,12 @@ class TestPaymentOrderInboundBase(AccountTestInvoicingCommon):
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.company = cls.company_data["company"]
cls.env.user.company_id = cls.company.id
cls.product = cls.env["product.product"].create(
{
"name": "Test product",
"type": "service",
}
)
cls.partner = cls.env["res.partner"].create(
{
"name": "Test Partner",
@@ -71,7 +77,7 @@ class TestPaymentOrderInboundBase(AccountTestInvoicingCommon):
) as invoice_form:
invoice_form.partner_id = self.partner
with invoice_form.invoice_line_ids.new() as invoice_line_form:
invoice_line_form.product_id = self.env.ref("product.product_product_4")
invoice_line_form.product_id = self.product
invoice_line_form.name = "product that cost 100"
invoice_line_form.quantity = 1
invoice_line_form.price_unit = 100.0

View File

@@ -53,6 +53,12 @@ class TestPaymentOrderOutboundBase(AccountTestInvoicingCommon):
).id,
}
)
cls.product = cls.env["product.product"].create(
{
"name": "Test product",
"type": "service",
}
)
cls.invoice = cls._create_supplier_invoice(cls, "F1242")
cls.invoice_02 = cls._create_supplier_invoice(cls, "F1243")
cls.bank_journal = cls.company_data["default_journal_bank"]
@@ -77,7 +83,7 @@ class TestPaymentOrderOutboundBase(AccountTestInvoicingCommon):
0,
None,
{
"product_id": self.env.ref("product.product_product_4").id,
"product_id": self.product.id,
"quantity": 1.0,
"price_unit": 100.0,
"name": "product that cost 100",
@@ -104,7 +110,7 @@ class TestPaymentOrderOutboundBase(AccountTestInvoicingCommon):
0,
None,
{
"product_id": self.env.ref("product.product_product_4").id,
"product_id": self.product.id,
"quantity": 1.0,
"price_unit": 90.0,
"name": "refund of 90.0",