Skip to content

Commit

Permalink
Merge PR #44 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by huguesdk
  • Loading branch information
github-grap-bot committed Oct 11, 2024
2 parents 1ac5cdc + 295fd15 commit be31f62
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
2 changes: 2 additions & 0 deletions hr_timesheet_overtime/demo/hr_contract_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
<!-- Part time-->
<record id="resource_calendar_part_time1" model="resource.calendar">
<field name="name">4/5</field>
<field name="attendance_ids" eval="False" />
</record>

<record id="resource_calendar_part_time2" model="resource.calendar">
<field name="name">1/5</field>
<field name="attendance_ids" eval="False" />
</record>

<!-- Working Hours 4/5 -->
Expand Down
28 changes: 17 additions & 11 deletions hr_timesheet_overtime/i18n/hr_timesheet_overtime.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ""

2 changes: 1 addition & 1 deletion hr_timesheet_overtime/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
22 changes: 20 additions & 2 deletions hr_timesheet_overtime/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
)
1 change: 1 addition & 0 deletions hr_timesheet_overtime/views/hr_timesheet_sheet_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
decoration-warning="total_overtime &lt; 0"
decoration-info="total_overtime &gt;= 0"
/>
<field name="current_resource_calendar_id" />
</xpath>

</field>
Expand Down

0 comments on commit be31f62

Please sign in to comment.