diff --git a/stock_vertical_lift/models/vertical_lift_operation_base.py b/stock_vertical_lift/models/vertical_lift_operation_base.py index c96e78c997f9..5b9dc84d7ed2 100644 --- a/stock_vertical_lift/models/vertical_lift_operation_base.py +++ b/stock_vertical_lift/models/vertical_lift_operation_base.py @@ -229,6 +229,8 @@ def button_release(self): self.next_step() def _render_product_packagings(self, product): + if not product: + return "" return self.env["ir.qweb"].render( "stock_vertical_lift.packagings", self._prepare_values_for_product_packaging(product), @@ -343,10 +345,10 @@ def on_barcode_scanned(self, barcode): @api.depends("current_move_line_id.product_id.packaging_ids") def _compute_product_packagings(self): for record in self: - if not record.current_move_line_id: + product = record.current_move_line_id.product_id + if not product: record.product_packagings = "" continue - product = record.current_move_line_id.product_id content = self._render_product_packagings(product) record.product_packagings = content diff --git a/stock_vertical_lift/models/vertical_lift_operation_inventory.py b/stock_vertical_lift/models/vertical_lift_operation_inventory.py index 5d9eadaa6326..93805a4a19ba 100644 --- a/stock_vertical_lift/models/vertical_lift_operation_inventory.py +++ b/stock_vertical_lift/models/vertical_lift_operation_inventory.py @@ -143,10 +143,10 @@ def _compute_tray_data(self): @api.depends("current_inventory_line_id.product_id.packaging_ids") def _compute_product_packagings(self): for record in self: - if not record.current_inventory_line_id: + product = record.current_inventory_line_id.product_id + if not product: record.product_packagings = "" continue - product = record.current_inventory_line_id.product_id content = self._render_product_packagings(product) record.product_packagings = content