Skip to content

Commit 12dc35a

Browse files
CopilotCRogos
andauthored
fix: replace removed demo data ref and fix translation format in sale_product_set
Agent-Logs-Url: https://github.com/c4a8-odoo/module-oca-sale-workflow/sessions/fe196e62-1ff2-4cc2-b5ba-08aa317590e6 Co-authored-by: CRogos <1799080+CRogos@users.noreply.github.com>
1 parent 5a691f3 commit 12dc35a

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

sale_product_set/tests/test_product_set.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,29 @@ def setUpClass(cls):
1313
super().setUpClass()
1414
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
1515
cls.so_model = cls.env["sale.order"]
16-
cls.so = cls.env.ref("sale.sale_order_6")
1716
cls.product_set_add = cls.env["sale.product.set.wizard"]
1817
cls.product_set = cls.env.ref("product_set.product_set_i5_computer")
18+
# Create a test product and sale order (demo sale.sale_order_6 removed in 19.0)
19+
test_product = cls.env["product.product"].create(
20+
{"name": "Test Product For SO", "type": "consu"}
21+
)
22+
cls.so = cls.so_model.create(
23+
{
24+
"partner_id": cls.env.ref("base.res_partner_1").id,
25+
"order_line": [
26+
(
27+
0,
28+
0,
29+
{
30+
"product_id": test_product.id,
31+
"product_uom_qty": 1,
32+
"price_unit": 10.0,
33+
"name": "Test Product For SO",
34+
},
35+
)
36+
],
37+
}
38+
)
1939

2040
def _get_wiz(self, ctx=None, **kw):
2141
vals = {
@@ -165,7 +185,7 @@ def test_discount(self):
165185
prod_set = self.env["product.set"].create(
166186
{"name": "Test", "set_line_ids": [(4, set_line.id)]}
167187
)
168-
so = self.env.ref("sale.sale_order_6")
188+
so = self.so
169189
wiz = self.product_set_add.create(
170190
{"order_id": so.id, "product_set_id": prod_set.id, "quantity": 1}
171191
)
@@ -186,7 +206,7 @@ def test_product_set_delete_in_wizard(self):
186206
self.assertEqual(len(self.so.order_line), 3)
187207

188208
def test_add_set_section(self):
189-
so = self.env.ref("sale.sale_order_6")
209+
so = self.so
190210
base_line_ids = so.order_line
191211
count_lines = len(so.order_line)
192212
product_set_with_section = self.env.ref("product_set.product_set_services")

sale_product_set/wizard/sale_product_set_wizard.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def _check_partner(self):
5151
if self.order_id.partner_id not in allowed_partners:
5252
raise exceptions.ValidationError(
5353
self.env._(
54-
"You can use a sale order assigned "
55-
"only to following partner(s): {}"
56-
).format(", ".join(allowed_partners.mapped("name")))
54+
"You can use a sale order assigned only to following partner(s): %s"
55+
)
56+
% ", ".join(allowed_partners.mapped("name"))
5757
)
5858
return super()._check_partner()
5959

0 commit comments

Comments
 (0)