[FIX] stock: avoid traceback when changing operation type

Steps to reproduce the bug:
- create a new transfer
- Click on new line but leave it empty
- Change operation type

Problem:
A traceback is triggered, because the onchange of picking_type is
triggered, so we try to get the description of each product in each
move. However, since the move does not have a product set,
an error is thrown:
https://github.com/odoo/odoo/blob/16.0/addons/stock/models/product.py#L235-L239

opw-3349646

closes odoo/odoo#125125

X-original-commit: 3db056a8a7a471a6eab800217bbe0690605d8db0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
This commit is contained in:
Touati Djamel (otd)
2023-06-15 13:33:42 +02:00
parent 44509d46f3
commit 960de00ea2
+2
View File
@@ -721,6 +721,8 @@ class Picking(models.Model):
"company_id": self.company_id,
})
for move in (self.move_ids | self.move_ids_without_package):
if not move.product_id:
continue
move.description_picking = move.product_id._get_description(move.picking_type_id)
if self.partner_id and self.partner_id.picking_warn: