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

Module: Time Off

Entity: hr.leave.allocation

Compute Method: _compute_description_validity

View 17.0 View 18.0
Inputs Method Outputs
  • date_to
  • name
  • date_from
for allocation in self:
            if allocation.date_to:
-                 name_validity = _("%s (from %s to %s)", allocation.name, allocation.date_from.strftime("%b %d %Y"), allocation.date_to.strftime("%b %d %Y"))
+                 name_validity = _(
+                     "%(allocation_name)s (from %(date_from)s to %(date_to)s)",
+                     allocation_name=allocation.name,
+                     date_from=tools.format_date(self.env, allocation.date_from, date_format='MMM dd yyyy'),
+                     date_to=tools.format_date(self.env, allocation.date_to, date_format='MMM dd yyyy'),
+                 )
            else:
-                 name_validity = _("%s (from %s to No Limit)", allocation.name, allocation.date_from.strftime("%b %d %Y"))
+                 name_validity = _(
+                     "%(allocation_name)s (from %(date_from)s to No Limit)",
+                     allocation_name=allocation.name,
+                     date_from=tools.format_date(self.env, allocation.date_from, date_format='MMM dd yyyy'),
+                 )
            allocation.name_validity = name_validity
  • name_validity

Back to entity