From 960de00ea296a9ccd7c38072619ff176c688709d Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Wed, 14 Jun 2023 12:01:24 +0000 Subject: [PATCH] [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) Signed-off-by: Djamel Touati (otd) --- addons/stock/models/stock_picking.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 64b67c845e0..07b5c959a5c 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -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: