Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Lunch

Entity: lunch.supplier

Compute Method: _compute_order_deadline_passed

View 18.0 View 20.0
Inputs Method Outputs
  • send_by
  • tz
  • automatic_email_time
  • moment
  • available_today
- now = fields.Datetime.now().replace(tzinfo=pytz.UTC)
+ now = fields.Datetime.now().replace(tzinfo=UTC)
for supplier in self:
            if supplier.send_by == 'mail':
-                 now = now.astimezone(pytz.timezone(supplier.tz))
-                 email_time = pytz.timezone(supplier.tz).localize(datetime.combine(
-                     fields.Date.context_today(supplier),
-                     float_to_time(supplier.automatic_email_time, supplier.moment)))
+                 now = now.astimezone(ZoneInfo(supplier.tz))
+                 email_time = datetime.combine(fields.Date.context_today(supplier), float_to_time(supplier.automatic_email_time), tzinfo=ZoneInfo(supplier.tz))
                supplier.order_deadline_passed = supplier.available_today and now > email_time
            else:
                supplier.order_deadline_passed = not supplier.available_today
  • order_deadline_passed

Back to entity