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

Module: Resource

Entity: resource.calendar

Compute Method: _compute_two_weeks_explanation

Inputs Method Outputs
today = fields.Date.today()
week_type = self.env['resource.calendar.attendance'].get_week_type(today)
week_type_str = self.env._("even") if week_type else self.env._("odd")
first_day = date_utils.start_of(today, 'week')
last_day = date_utils.end_of(today, 'week')
self.two_weeks_explanation = self.env._(
            "The current week (from %(first_day)s to %(last_day)s) corresponds to %(number)s week.",
            first_day=first_day,
            last_day=last_day,
            number=week_type_str,
        )

Back to entity