Skip to content

Commit 97a66c3

Browse files
committed
[FIX] product_catalog_tree: add warehouse location filter for sale orders
closes #843 Signed-off-by: matiasperalta1 <mnp@adhoc.com.ar>
1 parent bb23eba commit 97a66c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

product_catalog_tree/models/product_catalog_mixin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ def action_add_from_catalog(self):
1111
search_view_id = self.env.ref("product.product_search_form_view").id
1212
action["views"] = [(tree_view_id, "list")] + action["views"]
1313
action["search_view_id"] = (search_view_id, "search")
14+
# add warehouse location filter if order has warehouse
15+
context = action.get("context", {})
16+
if "order_id" in context and self._name == "sale.order":
17+
if self._fields.get("warehouse_id") and self.warehouse_id:
18+
action["context"]["search_default_location_id"] = self.warehouse_id.lot_stock_id.id
1419
return action

0 commit comments

Comments
 (0)