diff --git a/yuthon_catering/models/yuthon_catering.py b/yuthon_catering/models/yuthon_catering.py index 8b4eebbd6..305c1fa7f 100644 --- a/yuthon_catering/models/yuthon_catering.py +++ b/yuthon_catering/models/yuthon_catering.py @@ -279,8 +279,17 @@ class YuthonCatering(models.Model): def batch_confirm_catering(self): + from datetime import date as date_cls + valid_months = [ + (2025, 12), + (2026, 1), + (2026, 2), + ] records = self.env['yuthon.catering'].browse(self._context.get('active_ids', [])) - records.write({ + filtered = records.filtered( + lambda r: r.date and (r.date.year, r.date.month) in valid_months + ) + filtered.write({ 'state': 'confirmed', 'breakfast': True, 'lunch': True,