addons-cm/website_sale_aplicoop/views
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
..
group_order_views.xml group order form notebook 2026-05-21 17:37:22 +02:00
load_from_history_templates.xml lint: fix linter warnings (log exceptions, disable attribute-string-redundant, suppress C901 where necessary) 2026-05-20 16:05:14 +02:00
portal_templates.xml disable load in cart portal buttons 2026-05-21 13:50:50 +02:00
product_category_views.xml [IMP] website_sale_aplicoop: add sequence field to product.category for web ordering 2026-05-20 16:05:14 +02:00
product_template_views.xml Aplicoop desde el repo de kidekoop 2026-02-11 15:32:11 +01:00
res_config_settings_views.xml feat(website_sale_aplicoop): sistema de ribbons basado en stock 2026-02-25 19:48:39 +01:00
res_partner_views.xml [IMP] website_sale_aplicoop: propagate consumer_group_id directly from group_order 2026-03-06 13:49:13 +01:00
sale_order_views.xml lint: fix linter warnings (log exceptions, disable attribute-string-redundant, suppress C901 where necessary) 2026-05-20 16:05:14 +02:00
stock_picking_views.xml [DOC] website_sale_aplicoop: Add lazy loading documentation and implement v18.0.1.3.0 feature 2026-02-16 18:39:39 +01:00
website_sale_disable_cart.xml [IMP] website_sale_aplicoop: disable standard website_sale cart — hide header cart, remove add-to-cart, redirect cart routes to /eskaera 2026-05-20 16:05:14 +02:00
website_templates.xml [IMP] website_sale_aplicoop: filter and cap stock using forecasted net qty 2026-06-12 18:18:40 +02:00