Skip to content

Commit 48f7c55

Browse files
committed
Merge PR #218 into 18.0
Signed-off-by pedrobaeza
2 parents 6578de9 + c750337 commit 48f7c55

File tree

6 files changed

+164
-355
lines changed

6 files changed

+164
-355
lines changed

sale_product_pack/tests/common.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2025 Tecnativa - Pedro M. Baeza
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import Command
5+
6+
from odoo.addons.product_pack.tests.common import ProductPackCommon
7+
8+
9+
class TestSaleProductPackBase(ProductPackCommon):
10+
@classmethod
11+
def setUpClass(cls):
12+
super().setUpClass()
13+
pricelist = cls.env["product.pricelist"].create(
14+
{
15+
"name": "Test",
16+
"company_id": cls.env.company.id,
17+
"item_ids": [
18+
Command.create(
19+
{
20+
"applied_on": "3_global",
21+
"compute_price": "formula",
22+
"base": "list_price",
23+
},
24+
)
25+
],
26+
}
27+
)
28+
cls.discount_pricelist = cls.env["product.pricelist"].create(
29+
{
30+
"name": "Discount",
31+
"company_id": cls.env.company.id,
32+
"item_ids": [
33+
Command.create(
34+
{
35+
"applied_on": "3_global",
36+
"compute_price": "percentage",
37+
"percent_price": 10,
38+
},
39+
)
40+
],
41+
}
42+
)
43+
cls.sale_order = cls.env["sale.order"].create(
44+
{
45+
"company_id": cls.env.company.id,
46+
"partner_id": cls.env.ref("base.res_partner_12").id,
47+
"pricelist_id": pricelist.id,
48+
}
49+
)
50+
51+
def _add_so_line(self, product=None, sequence=10):
52+
product = product or self.pack
53+
return self.env["sale.order.line"].create(
54+
{
55+
"order_id": self.sale_order.id,
56+
"name": product.name,
57+
"product_id": product.id,
58+
"product_uom_qty": 1,
59+
"sequence": sequence,
60+
}
61+
)

0 commit comments

Comments
 (0)