diff --git a/models/hr_timesheet.py b/models/hr_timesheet.py index c15c513d4aed6858f481d6b0a6325f69edfcbc8f..7a34801338690717e37eba4110e7914e59e7f34c 100644 --- a/models/hr_timesheet.py +++ b/models/hr_timesheet.py @@ -214,6 +214,10 @@ class ScopHrTimesheet(models.Model): @api.constrains("date") def _check_weekday(self): + + if self.env.company.weekend_working: + return + for line in self: dt = datetime.combine(line.date, time(12, 00)) holiday = self.env["resource.calendar.leaves"].search( diff --git a/models/res_company.py b/models/res_company.py index 347bda9eb41e092b10e0ed081b74b1ae5d4db16a..e42b6c818e15f5411e9b20a31667129b7c222c7e 100644 --- a/models/res_company.py +++ b/models/res_company.py @@ -23,6 +23,11 @@ class ResCompanyTmesheet(models.Model): default=False, help="Si cette option est cochée, un employé peut déclarer des heures supplémentaire" ) + weekend_working = fields.Boolean( + string="Travail le weekend", + default=False, + help="Si cette option est cochée, un employé peut imputer le weekend", + ) use_travel_time = fields.Boolean( string="Saisie des temps de déplacement", default=False, diff --git a/views/res_company.xml b/views/res_company.xml index 8c31bd9332dd50dbd011dcd79d7b5e2e1647287e..ca85aaad9757145cdbac3cb44ca6c077de67e64d 100644 --- a/views/res_company.xml +++ b/views/res_company.xml @@ -18,6 +18,7 @@ attrs="{'invisible': [('day_working', '=', True)]}" /> <field name="overtime_working" widget="boolean_toggle" /> + <field name="weekend_working" widget="boolean_toggle" /> <field name="use_travel_time" widget="boolean_toggle" /> </group> </group>