addons14/project_timesheet_time_control/models/hr_timesheet_time_control_mixin.py
def _compute_show_time_control(self):
        """Decide which time control button to show, if any."""
        related_field = self._relation_with_timesheet_line()
        grouped = self.env["account.analytic.line"].read_group(
            domain=self._timesheet_running_domain(),
            fields=["id"],
            groupby=[related_field],
        )
        lines_per_record = {
            group[related_field][0]: group["%s_count" % related_field]
            for group in grouped
        }
        button_per_lines = {0: "start", 1: "stop"}
        for record in self:
            record.show_time_control = button_per_lines.get(
                lines_per_record.get(record.id, 0),
                False,
            )
Decide which time control button to show, if any.
Decide which time control button to show, if any.
Decide which time control button to show if any .
def _compute_show_time_control(self):
        related_field = self._relation_with_timesheet_line()
        grouped = self.env["account.analytic.line"].read_group(
            domain=self._timesheet_running_domain(),
            fields=["id"],
            groupby=[related_field],
        )
        lines_per_record = {
            group[related_field][0]: group["%s_count" % related_field]
            for group in grouped
        }
        button_per_lines = {0: "start", 1: "stop"}
        for record in self:
            record.show_time_control = button_per_lines.get(
                lines_per_record.get(record.id, 0),
                False,
            )
def _compute_show_time_control ( self ) : related_field = self . _relation_with_timesheet_line ( ) grouped = self . env [ "account.analytic.line" ] . read_group ( domain = self . _timesheet_running_domain ( ) , fields = [ "id" ] , groupby = [ related_field ] , ) lines_per_record = { group [ related_field ] [ 0 ] : group [ "%s_count" % related_field ] for group in grouped } button_per_lines = { 0 : "start" , 1 : "stop" } for record in self : record . show_time_control = button_per_lines . get ( lines_per_record . get ( record . id , 0 ) , False , )
Decide which time control button to show, if any.
Decide which time control button to show if any .
"""Decide which time control button to show, if any."""
self