Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions product_catalog_tree/models/product_catalog_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ def action_add_from_catalog(self):
action = super().action_add_from_catalog()
tree_view_id = self.env.ref("product_catalog_tree.product_view_tree_catalog").id
action["views"] = [(tree_view_id, "list")] + action["views"]
# add warehouse location filter if order has warehouse
context = action.get("context", {})
if "order_id" in context and self._name == "sale.order":
if self._fields.get("warehouse_id") and self.warehouse_id:
action["context"]["search_default_location_id"] = self.warehouse_id.lot_stock_id.id
return action