Compare commits

...

3 commits

Author SHA1 Message Date
snt
12d434d4c7 [IMP] website_sale_aplicoop: simplify cutoff guard in _confirm_linked_sale_orders
All group orders have cutoff configured; stale orders are already closed/cancelled.
Single guard: skip if cutoff_date >= today (cycle still open).
2026-03-30 19:29:10 +02:00
snt
7fc42625a3 [FIX] website_sale_aplicoop: robust cutoff check in _confirm_linked_sale_orders
Three guards before confirming sale orders:
1. Skip if no cutoff_date (no cutoff_day configured): avoids blindly confirming
   all draft orders for group orders without a weekly cycle defined
2. Skip if cutoff_date >= today: cycle still open
3. Skip if cutoff_date >= 7 days ago: stale date from a previous cycle
   (protects against cron gaps and confirms only within 1-6 days after cutoff)
2026-03-30 19:23:19 +02:00
snt
cd68e8bb5b [FIX] website_sale_aplicoop: revert >= to > condition in _confirm_linked_sale_orders
The cutoff day itself is still open for orders; confirmation should only
happen when the cutoff date is strictly in the past (>= today = skip).
The real bug was only the order of operations in _cron_update_dates.
2026-03-30 19:18:41 +02:00

View file

@ -667,9 +667,10 @@ class GroupOrder(models.Model):
""" """
self.ensure_one() self.ensure_one()
# Only confirm if cutoff date has reached or passed (>= cutoff day itself)
today = fields.Date.today() today = fields.Date.today()
if self.cutoff_date and self.cutoff_date > today:
# Skip if cutoff hasn't passed yet (the cycle is still open for orders)
if self.cutoff_date >= today:
_logger.info( _logger.info(
"Cron: Skipping group order %s (%s) - cutoff date %s not yet passed", "Cron: Skipping group order %s (%s) - cutoff date %s not yet passed",
self.id, self.id,