Skip to content

Commit

Permalink
fixup! [ADD] #57 allow higher value overtime for holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed Jan 22, 2024
1 parent 629cf13 commit 6742132
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
13 changes: 13 additions & 0 deletions verdigado_attendance/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ def _get_effective_holiday_overtime_factor(self, date=None):
)
else 1
)

def _attendance_action_change(self):
"""React to default flag for overtime factor"""
result = super()._attendance_action_change()
if "default_apply_holiday_overtime_factor" in self.env.context:
result.write(
{
"apply_holiday_overtime_factor": self.env.context[
"default_apply_holiday_overtime_factor"
],
}
)
return result
12 changes: 12 additions & 0 deletions verdigado_attendance/static/src/js/hr_attendance.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,17 @@ odoo.define("verdigado_attendance.hr_attendance", function (require) {
});
return Promise.all([this._super.apply(this, arguments), promise]);
},
_rpc: function (params) {
if (
params &&
params.model === "hr.employee" &&
params.method === "attendance_manual"
) {
params.context.default_apply_holiday_overtime_factor = this.$(
"#apply_holiday_overtime"
).is(":checked");
}
return this._super.apply(this, arguments);
},
});
});
7 changes: 4 additions & 3 deletions verdigado_attendance/static/src/xml/hr_attendance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<div t-if="checked_in and widget.effective_holiday_overtime_factor != 1">
<input type="checkbox" id="apply_holiday_overtime" checked="" />
<label for="apply_holiday_overtime">
Apply holiday overtime factor (
<t t-out="widget.effective_holiday_overtime_factor" />
)
Apply holiday overtime factor
<!-- prettier-ignore-start -->
(<t t-out="widget.effective_holiday_overtime_factor" />)
<!-- prettier-ignore-end -->
</label>
</div>
</xpath>
Expand Down

0 comments on commit 6742132

Please sign in to comment.