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

This commit is contained in:
Enric Tobella
2024-12-23 21:59:33 +01:00
committed by Weblate
parent e6093981f4
commit b40786a690

View File

@@ -5,11 +5,12 @@
from odoo import _, fields
from odoo.exceptions import UserError, ValidationError
from odoo.fields import Date
from odoo.tests.common import Form, TransactionCase
from odoo.tests.common import Form, TransactionCase, tagged
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
@tagged("-at_install", "post_install")
class TestAccountPaymentPartner(TransactionCase):
@classmethod
def setUpClass(cls):
@@ -162,8 +163,23 @@ class TestAccountPaymentPartner(TransactionCase):
],
limit=1,
)
bank = (
cls.env["res.bank"]
.env["res.bank"]
.create(
{
"name": "Fiducial Banque",
"bic": "FIDCFR21XXX",
"street": "38 rue Sergent Michel Berthet",
"zip": "69009",
"city": "Lyon",
"country": cls.env.ref("base.fr").id,
}
)
)
cls.journal_bank = cls.env["res.partner.bank"].create(
{
"bank_id": bank.id,
"acc_number": "GB95LOYD87430237296288",
"partner_id": cls.env.user.company_id.partner_id.id,
}
@@ -184,6 +200,12 @@ class TestAccountPaymentPartner(TransactionCase):
"journal_id": cls.journal_purchase.id,
}
)
cls.product = cls.env["product.product"].create(
{
"name": "Test product",
"type": "service",
}
)
def _create_invoice(self, default_move_type, partner):
move_form = Form(
@@ -192,7 +214,7 @@ class TestAccountPaymentPartner(TransactionCase):
move_form.partner_id = partner
move_form.invoice_date = Date.today()
with move_form.invoice_line_ids.new() as line_form:
line_form.product_id = self.env.ref("product.product_product_4")
line_form.product_id = self.product
line_form.name = "product that cost 100"
line_form.quantity = 1.0
line_form.price_unit = 100.0
@@ -531,7 +553,16 @@ class TestAccountPaymentPartner(TransactionCase):
)
def test_account_move_payment_mode_id_default(self):
payment_mode = self.env.ref("account_payment_mode.payment_mode_inbound_dd1")
payment_mode = self.env["account.payment.mode"].create(
{
"name": "Direct Debit of customers",
"company_id": self.env.ref("base.main_company").id,
"bank_account_link": "variable",
"payment_method_id": self.env.ref(
"account.account_payment_method_manual_in"
).id,
}
)
field = self.env["ir.model.fields"].search(
[
("model_id.model", "=", self.move_model._name),