From 51f5fd7f3da5211904c9ee7d2071e751d495fea6 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Thu, 8 Jul 2021 18:51:42 +0200 Subject: [PATCH] [fix] check_hours constrain on date --- models/hr_timesheet.py | 3 +-- views/hr_timesheet.xml | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/models/hr_timesheet.py b/models/hr_timesheet.py index 9c59199..c41b247 100644 --- a/models/hr_timesheet.py +++ b/models/hr_timesheet.py @@ -121,7 +121,6 @@ class ScopHrTimesheet(models.Model): result.append((ts.id, name)) return result - # ------------------------------------------------------ # OnChange Functions # ------------------------------------------------------ @@ -148,7 +147,7 @@ class ScopHrTimesheet(models.Model): # ------------------------------------------------------ # Contrains # ------------------------------------------------------ - @api.constrains('unit_amount') + @api.constrains('unit_amount', 'date') def _check_hours(self): for record in self: lines = self.search([ diff --git a/views/hr_timesheet.xml b/views/hr_timesheet.xml index 24c171b..98f7216 100644 --- a/views/hr_timesheet.xml +++ b/views/hr_timesheet.xml @@ -163,7 +163,11 @@ <field name="name">account.analytic.line.timesheet.cgscop.calendar</field> <field name="model">account.analytic.line</field> <field name="arch" type="xml"> - <calendar string="Ligne de temps" date_start="date" mode="month" quick_add="False" color="project_id" readonly_form_view_id="cgscop_timesheet.view_cgscop_hr_timesheet_line_form"> + <calendar string="Ligne de temps" + date_start="date" mode="month" + quick_add="False" + color="project_id" + readonly_form_view_id="cgscop_timesheet.view_cgscop_hr_timesheet_line_form"> <field name="calendar_l1"/> <field name="calendar_l2"/> </calendar> -- GitLab