diff --git a/hr_timesheet_overtime/demo/hr_contract_demo.xml b/hr_timesheet_overtime/demo/hr_contract_demo.xml
index 642431c..5fc5151 100644
--- a/hr_timesheet_overtime/demo/hr_contract_demo.xml
+++ b/hr_timesheet_overtime/demo/hr_contract_demo.xml
@@ -8,10 +8,12 @@
4/5
+
1/5
+
diff --git a/hr_timesheet_overtime/i18n/hr_timesheet_overtime.pot b/hr_timesheet_overtime/i18n/hr_timesheet_overtime.pot
index 28facea..153feb6 100644
--- a/hr_timesheet_overtime/i18n/hr_timesheet_overtime.pot
+++ b/hr_timesheet_overtime/i18n/hr_timesheet_overtime.pot
@@ -176,11 +176,6 @@ msgstr ""
msgid "Overtime Start Date to compute overtime"
msgstr ""
-#. module: hr_timesheet_overtime
-#: model:ir.model.fields,field_description:hr_timesheet_overtime.field_hr_timesheet_sheet__total_overtime
-msgid "Overtime Total"
-msgstr ""
-
#. module: hr_timesheet_overtime
#: model:ir.model.fields,help:hr_timesheet_overtime.field_hr_timesheet_sheet__daily_overtime
msgid "Overtime for the current day"
@@ -196,11 +191,6 @@ msgstr ""
msgid "Overtime for this timesheet period, from the employee's start date until today"
msgstr ""
-#. module: hr_timesheet_overtime
-#: model:ir.model.fields,help:hr_timesheet_overtime.field_hr_timesheet_sheet__total_overtime
-msgid "Overtime total since employee's overtime start date"
-msgstr ""
-
#. module: hr_timesheet_overtime
#: model:ir.model.fields,field_description:hr_timesheet_overtime.field_resource_overtime_rate__rate
msgid "Rate"
@@ -263,12 +253,18 @@ msgstr ""
#. module: hr_timesheet_overtime
#: model:ir.model.fields,field_description:hr_timesheet_overtime.field_hr_employee__total_overtime
+#: model:ir.model.fields,field_description:hr_timesheet_overtime.field_hr_timesheet_sheet__total_overtime
msgid "Total Overtime"
msgstr ""
#. module: hr_timesheet_overtime
#: model:ir.model.fields,help:hr_timesheet_overtime.field_hr_employee__total_overtime
-msgid "Total Overtime since Overtime Start Date"
+msgid "Total overtime since Overtime Start Date"
+msgstr ""
+
+#. module: hr_timesheet_overtime
+#: model:ir.model.fields,help:hr_timesheet_overtime.field_hr_timesheet_sheet__total_overtime
+msgid "Total overtime since employee's overtime start date"
msgstr ""
#. module: hr_timesheet_overtime
@@ -296,3 +292,13 @@ msgstr ""
msgid "Working Hours"
msgstr ""
+#. module: hr_timesheet_overtime
+#: model:ir.model.fields,field_description:hr_timesheet_overtime.field_hr_timesheet_sheet__current_resource_calendar_id
+msgid "Working Schedule"
+msgstr ""
+
+#. module: hr_timesheet_overtime
+#: model:ir.model.fields,help:hr_timesheet_overtime.field_hr_timesheet_sheet__current_resource_calendar_id
+msgid "Working schedule of the current day"
+msgstr ""
+
diff --git a/hr_timesheet_overtime/models/hr_employee.py b/hr_timesheet_overtime/models/hr_employee.py
index e48a0f1..b82d6a4 100644
--- a/hr_timesheet_overtime/models/hr_employee.py
+++ b/hr_timesheet_overtime/models/hr_employee.py
@@ -25,7 +25,7 @@ class HrEmployee(models.Model):
total_overtime = fields.Float(
string="Total Overtime",
compute="_compute_total_overtime",
- help="Total Overtime since Overtime Start Date",
+ help="Total overtime since Overtime Start Date",
store=True,
)
timesheet_sheet_ids = fields.One2many(
diff --git a/hr_timesheet_overtime/models/hr_timesheet_sheet.py b/hr_timesheet_overtime/models/hr_timesheet_sheet.py
index 6501b94..cf10ee7 100644
--- a/hr_timesheet_overtime/models/hr_timesheet_sheet.py
+++ b/hr_timesheet_overtime/models/hr_timesheet_sheet.py
@@ -44,9 +44,15 @@ class HrTimesheetSheet(models.Model):
store=True,
)
total_overtime = fields.Float(
- "Overtime Total",
+ "Total Overtime",
related="employee_id.total_overtime",
- help="Overtime total since employee's overtime start date",
+ help="Total overtime since employee's overtime start date",
+ )
+ current_resource_calendar_id = fields.Many2one(
+ "resource.calendar",
+ string="Working Schedule",
+ help="Working schedule of the current day",
+ compute="_compute_current_resource_calendar_id",
)
def get_worked_time(self, start_date, end_date=None):
@@ -156,3 +162,15 @@ def _compute_timesheet_overtime_trimmed(self):
working_time = employee.get_working_time(start_date, end_date)
worked_time = sheet.get_worked_time(start_date, end_date)
sheet.timesheet_overtime_trimmed = worked_time - working_time
+
+ @api.multi
+ @api.depends(
+ "company_id.today",
+ "employee_id.contract_ids.resource_calendar_id",
+ )
+ def _compute_current_resource_calendar_id(self):
+ today = self.company_id.today
+ for sheet in self:
+ sheet.current_resource_calendar_id = (
+ sheet.employee_id.get_calendar_for_date(today)
+ )
diff --git a/hr_timesheet_overtime/views/hr_timesheet_sheet_view.xml b/hr_timesheet_overtime/views/hr_timesheet_sheet_view.xml
index a97330b..e17b359 100644
--- a/hr_timesheet_overtime/views/hr_timesheet_sheet_view.xml
+++ b/hr_timesheet_overtime/views/hr_timesheet_sheet_view.xml
@@ -71,6 +71,7 @@
decoration-warning="total_overtime < 0"
decoration-info="total_overtime >= 0"
/>
+