feat: persistent hidden categories with wizard and toggle
Categories to hide are stored on woo.instance and persist across sessions. Click 'Hidden (N)' button to open wizard where you can add/remove categories using a tag picker. Eye/eye-slash toggle to quickly apply or unapply the filter without losing the saved list. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,8 @@ class WooProductSearchController(http.Controller):
|
||||
type='jsonrpc', auth='user', methods=['POST'],
|
||||
)
|
||||
def search_odoo_products(self, query='', instance_id=None, limit=20, offset=0,
|
||||
category_id=None, exclude_category_ids=None, **kw):
|
||||
category_id=None, exclude_category_ids=None,
|
||||
apply_excluded=False, **kw):
|
||||
"""
|
||||
Search Odoo products by name or internal reference (SKU).
|
||||
|
||||
@@ -61,6 +62,12 @@ class WooProductSearchController(http.Controller):
|
||||
if exclude_category_ids:
|
||||
domain.append(('categ_id', 'not in', [int(x) for x in exclude_category_ids]))
|
||||
|
||||
# Apply instance-level excluded categories
|
||||
if apply_excluded and instance_id:
|
||||
instance = request.env['woo.instance'].browse(int(instance_id))
|
||||
if instance.exists() and instance.excluded_category_ids:
|
||||
domain.append(('categ_id', 'not in', instance.excluded_category_ids.ids))
|
||||
|
||||
total = request.env['product.product'].search_count(domain)
|
||||
products = request.env['product.product'].search(domain, limit=limit, offset=offset)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user