Files
Odoo-18.0-20251222/account_invoice_section_sale_order/tests/common.py
tocmo0nlord adbe430761
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled
Initial commit: Odoo 18.0-20251222 extra-addons
2026-03-13 20:43:25 +00:00

90 lines
3.3 KiB
Python

from odoo.tests import tagged
from odoo.tests.common import TransactionCase
@tagged("-at_install", "post_install")
class Common(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.setUpClassOrder()
@classmethod
def setUpClassOrder(cls):
cls.partner_1 = cls.env.ref("base.res_partner_1")
cls.product_1 = cls.env.ref("product.product_product_1")
cls.product_2 = cls.env.ref("product.product_product_2")
cls.product_1.invoice_policy = "order"
cls.product_2.invoice_policy = "order"
cls.pricelist = cls.env["product.pricelist"].create(
{"name": "Europe pricelist", "currency_id": cls.env.ref("base.EUR").id}
)
cls.order1_p1 = cls.env["sale.order"].create(
{
"partner_id": cls.partner_1.id,
"partner_shipping_id": cls.partner_1.id,
"partner_invoice_id": cls.partner_1.id,
"client_order_ref": "ref123",
"pricelist_id": cls.pricelist.id,
"order_line": [
(
0,
0,
{
"name": "order 1 line 1",
"product_id": cls.product_1.id,
"price_unit": 20,
"product_uom_qty": 1,
"product_uom": cls.product_1.uom_id.id,
},
),
(
0,
0,
{
"name": "order 1 line 2",
"product_id": cls.product_2.id,
"price_unit": 20,
"product_uom_qty": 1,
"product_uom": cls.product_1.uom_id.id,
},
),
],
}
)
cls.order1_p1.action_confirm()
cls.order2_p1 = cls.env["sale.order"].create(
{
"partner_id": cls.partner_1.id,
"partner_shipping_id": cls.partner_1.id,
"partner_invoice_id": cls.partner_1.id,
"pricelist_id": cls.pricelist.id,
"order_line": [
(
0,
0,
{
"name": "order 2 line 1",
"product_id": cls.product_1.id,
"price_unit": 20,
"product_uom_qty": 1,
"product_uom": cls.product_1.uom_id.id,
},
),
(
0,
0,
{
"name": "order 2 line 2",
"product_id": cls.product_2.id,
"price_unit": 20,
"product_uom_qty": 1,
"product_uom": cls.product_1.uom_id.id,
},
),
],
}
)
cls.order2_p1.action_confirm()