From 28f8d7d1cdc8437f7eae8650f501458ea30a4796 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 19 Aug 2024 13:00:30 +0200 Subject: [PATCH] [FIX] stock_vlm_mgmt: location general inventory We were lacking the default location id so we could select the tray. It was also needed to avoid compting a pos when no tray is selected. --- stock_vlm_mgmt/models/stock_location.py | 1 + stock_vlm_mgmt/models/vlm_tray_cell_position_mixin.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stock_vlm_mgmt/models/stock_location.py b/stock_vlm_mgmt/models/stock_location.py index 8e7925e92..dc494d7a7 100644 --- a/stock_vlm_mgmt/models/stock_location.py +++ b/stock_vlm_mgmt/models/stock_location.py @@ -131,6 +131,7 @@ class StockLocation(models.Model): action["context"] = dict( self.env.context, vlm_inventory_mode=True, + default_location_id=self.id, ) view_id = self.env.ref("stock_vlm_mgmt.view_stock_quant_inventory_tree").id action.update( diff --git a/stock_vlm_mgmt/models/vlm_tray_cell_position_mixin.py b/stock_vlm_mgmt/models/vlm_tray_cell_position_mixin.py index 3fdce5fa3..ba2d90b32 100644 --- a/stock_vlm_mgmt/models/vlm_tray_cell_position_mixin.py +++ b/stock_vlm_mgmt/models/vlm_tray_cell_position_mixin.py @@ -38,7 +38,7 @@ class VlmTrayCellPositionMixin(models.AbstractModel): @api.depends("tray_matrix") def _compute_pos(self): - for record in self: + for record in self.filtered("tray_matrix"): if not record.tray_matrix["selected"]: continue record.update(