addons-cm/website_sale_aplicoop/tests
GitHub Copilot 1d6747e703 [IMP] website_sale_aplicoop: filter and cap stock using forecasted net qty
Group orders are not confirmed until the cutoff date, so draft/sent
sale.order lines never generate stock.moves and are invisible to
virtual_available. This change makes the shop aware of that demand.

- group.order._compute_draft_sale_demand: queries sale.order.line in
  draft/sent state (mirroring sale_stock forecasted report logic) and
  returns pending demand per product.id in the product's own UoM.
- _get_products_for_group_order: delegates to new _apply_stock_filter_and_sort
  which excludes storable products whose forecasted net qty
  (virtual_available − draft demand) <= 0, unless allow_out_of_stock_order.
- _compute_stock_ribbons: reads draft_demand_by_product from ORM context
  so is_out_of_stock / is_low_stock / dynamic_ribbon_id reflect net qty.
- Controller: new _prepare_draft_stock_data helper calculates demand once
  per request, injects context, and builds product_max_qty dict. Applied
  in eskaera_shop, load_eskaera_page and load_products_ajax.
- Template: qty input gets max and data-max-qty from product_max_qty.
- JS: blocks add-to-cart if requested quantity exceeds data-max-qty.
- Fixes type check: type=='consu' → is_storable=True (Odoo 18 semantics).
- 21 new tests in test_forecasted_stock.py covering demand calculation,
  ribbon logic with context, and group order filtering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 18:18:40 +02:00
..
__init__.py [IMP] website_sale_aplicoop: filter and cap stock using forecasted net qty 2026-06-12 18:18:40 +02:00
COBERTURA_TESTS_ANALISIS.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
PHASE3_TEST_SUMMARY.md [DOC] website_sale_aplicoop: Add lazy loading documentation and implement v18.0.1.3.0 feature 2026-02-16 18:39:39 +01:00
test_cron_picking_batch.py [IMP] website_sale_aplicoop: Validar disponibilidad de productos al cargar órdenes históricas 2026-05-20 16:05:14 +02:00
test_date_calculations.py [FIX] website_sale_aplicoop: harden group order cron 2026-03-31 19:36:20 +02:00
test_draft_persistence.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00
test_edge_cases.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00
test_endpoints.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00
test_eskaera_shop.py [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
test_forecasted_stock.py [IMP] website_sale_aplicoop: filter and cap stock using forecasted net qty 2026-06-12 18:18:40 +02:00
test_group_order.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00
test_group_order_status_endpoint.py [FIX] website_sale_aplicoop: scope draft lookup to active cycle window 2026-05-29 17:40:48 +02:00
test_helper_methods_phase1.py [REFACTOR] Phase 1: Add 3 helper methods and tests (pre-commit skipped for C901) 2026-02-16 15:41:03 +01:00
test_home_delivery.py [TEST] website_sale_aplicoop: add tests for home_delivery computed field 2026-05-20 17:49:50 +02:00
test_multi_company.py [FIX] website_sale_aplicoop: lint fixes (exception chaining, imports, remove unused vars) 2026-05-20 16:05:14 +02:00
test_phase2_eskaera_shop.py [IMP] website_sale_aplicoop: Phase 2 - Refactor eskaera_shop() and add_to_eskaera_cart() 2026-02-16 15:47:15 +01:00
test_phase3_confirm_eskaera.py [TEST] website_sale_aplicoop: add tests for home_delivery computed field 2026-05-20 17:49:50 +02:00
test_portal_access.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00
test_portal_get_routes.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00
test_portal_product_uom_access.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00
test_portal_sale_order_creation.py feat(website_sale_aplicoop): ordenar productos por website_sequence y nombre 2026-02-25 19:34:49 +01:00
test_price_with_taxes_included.py Revertir cambio: eliminar cálculo duplicado de impuestos 2026-02-11 19:54:28 +01:00
test_pricing_with_pricelist.py [FIX] website_sale_aplicoop: align pricing and drafts 2026-02-27 19:39:25 +01:00
test_product_discovery.py [ADD] website_sale_aplicoop: Category blacklist with recursive exclusion 2026-02-22 23:04:33 +01:00
test_product_extension.py [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
test_record_rules.py [FIX] website_sale_aplicoop: lint fixes (exception chaining, imports, remove unused vars) 2026-05-20 16:05:14 +02:00
test_res_partner.py [IMP] website_sale_aplicoop: propagate consumer_group_id directly from group_order 2026-03-06 13:49:13 +01:00
test_save_order_endpoints.py [TEST] website_sale_aplicoop: add tests for home_delivery computed field 2026-05-20 17:49:50 +02:00
test_templates_rendering.py [FIX] Resolver 3 fallos de tests en website_sale_aplicoop 2026-03-30 16:21:57 +02:00
test_validations.py [REF] Code quality improvements and structure fixes 2026-02-21 13:51:25 +01:00