Skip to content

Commit 90d412d

Browse files
committed
[MIG] stock_picking_report_custom_description: Migration to 19.0
1 parent a137ac4 commit 90d412d

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

stock_picking_report_custom_description/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"name": "Stock Picking Report Custom Description",
99
"summary": "Show moves description in picking reports",
10-
"version": "18.0.1.0.0",
10+
"version": "19.0.1.0.0",
1111
"category": "Warehouse",
1212
"website": "https://github.com/OCA/stock-logistics-reporting",
1313
"author": "Tecnativa, Odoo Community Association (OCA)",

stock_picking_report_custom_description/models/stock_rule.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@ def _get_stock_move_values(
4141
and description_picking != line.product_id.display_name
4242
):
4343
res["description_picking"] = description_picking
44-
res["name"] = line.name
4544
return res

stock_picking_report_custom_description/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
- Carolina Fernandez
77
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
88
- Bhavesh Heliconia
9+
- [Studio73](https://www.studio73.es)
10+
- Miguel Gandia

stock_picking_report_custom_description/tests/test_stock_picking_report_custom_description.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,50 @@ def setUpClass(cls):
1616
{
1717
"name": "Test product",
1818
"type": "consu",
19-
"description_sale": "Custom description",
2019
}
2120
)
2221
order_form = Form(cls.env["sale.order"])
2322
order_form.partner_id = cls.customer
2423
with order_form.order_line.new() as line_form:
2524
line_form.product_id = cls.product
25+
line_form.name = f"{cls.product.display_name}\nCustom description"
2626
cls.order = order_form.save()
2727

2828
def test_so_custom_description_transfer_to_picking(self):
2929
self.order.action_confirm()
3030
self.assertEqual(
3131
self.order.order_line.move_ids.description_picking, "Custom description"
3232
)
33-
self.order.order_line.name = "Custom description 2"
33+
self.order.order_line.name = (
34+
f"{self.order.order_line.product_id.display_name}\nCustom description 2"
35+
)
3436
self.assertEqual(
3537
self.order.order_line.move_ids.description_picking,
3638
self.order.order_line.name,
3739
)
40+
# Test description_picking no change when update other field than name
41+
self.order.order_line.price_unit = 42.0
42+
self.assertEqual(
43+
self.order.order_line.move_ids.description_picking,
44+
self.order.order_line.name,
45+
)
46+
# Test description_picking when order line name is empty
47+
order_form = Form(self.env["sale.order"])
48+
order_form.partner_id = self.customer
49+
with order_form.order_line.new() as line_form:
50+
line_form.product_id = self.product
51+
line_form.name = ""
52+
order2 = order_form.save()
53+
order2.action_confirm()
54+
self.assertEqual(order2.order_line.move_ids.description_picking, "Test product")
55+
# Test when auto create picking when confirm other doc than SO
56+
self.env["stock.rule"]._get_stock_move_values(
57+
product_id=self.product,
58+
product_qty=1,
59+
product_uom=self.product.uom_id,
60+
location_id=self.env.ref("stock.stock_location_customers"),
61+
name="Test move",
62+
origin="Test origin",
63+
company_id=self.env.company,
64+
values={"date_planned": "2024-01-01 00:00:00"},
65+
)

0 commit comments

Comments
 (0)