[ADD] website_sale_aplicoop: Category blacklist with recursive exclusion

- Add comprehensive test suite for excluded_category_ids
- 9 tests covering: single category, recursive subcategories,
  parent exclusion, direct product override, unrelated categories,
  empty blacklist, multiple exclusions, combined blacklists,
  available_products_count validation
- Update UI to show excluded_category_ids in 'Productos Excluidos'
- Bump version to 18.0.1.6.0
- Update CHANGELOG with category blacklist documentation

Technical notes:
- Category blacklist was already implemented in model/logic
- This commit adds missing tests and documentation
- Recursive exclusion via get_all_excluded_descendants()
- Blacklist has absolute priority over all inclusion sources
This commit is contained in:
snt 2026-02-22 23:04:33 +01:00
parent d90f2cdc61
commit c1226e720b
7 changed files with 413 additions and 1 deletions

View file

@ -1,5 +1,43 @@
# Changelog - Website Sale Aplicoop
## [18.0.1.6.0] - 2026-02-22
### Added
- **Category Blacklist Feature**: Category-based exclusion system for group orders
- New field: `excluded_category_ids` (Many2many to product.category)
- Recursive exclusion: Excludes products in selected categories AND all subcategories
- Blacklist has absolute priority over all inclusion sources
- Helper method: `get_all_excluded_descendants()` for recursive category tree traversal
- Comprehensive test suite in `test_product_discovery.py` (TestCategoryBlacklist class with 9 tests)
### Changed
- **Product Discovery Logic**: Extended to filter by category blacklist
- `_get_products_for_group_order()` now applies `excluded_category_ids` filter recursively
- Products in excluded categories and their subcategories are filtered out
- `_compute_available_products_count()` now depends on `excluded_category_ids`
- Detailed logging for excluded categories and affected products
- **UI Updates**: "Productos Excluidos" section now includes three blacklist types:
- `excluded_supplier_ids`: Blacklist suppliers
- `excluded_category_ids`: Blacklist categories (recursive)
- `excluded_product_ids`: Blacklist specific products
### Technical Details
- New M2M relation: `group_order_excluded_category_rel`
- Recursive logic: Walks category tree to find all descendants
- Filter logic: `products.filtered(lambda p: p.categ_id not in all_excluded_categories)`
- Works in combination with product and supplier blacklists (all filters apply)
### Use Case
- Admin wants to exclude all products in a category and its subcategories
- Example: Exclude "Fresh Produce" → automatically excludes "Fruits", "Vegetables", etc.
- Add parent category to inclusion → add problematic subcategory to exclusion
- Result: Fine-grained control over product catalog with minimal configuration
## [18.0.1.5.0] - 2026-02-22
### Added