Skip to content

Commit 6742132

Browse files
committed
fixup! [ADD] #57 allow higher value overtime for holidays
1 parent 629cf13 commit 6742132

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

verdigado_attendance/models/hr_employee.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,16 @@ def _get_effective_holiday_overtime_factor(self, date=None):
3939
)
4040
else 1
4141
)
42+
43+
def _attendance_action_change(self):
44+
"""React to default flag for overtime factor"""
45+
result = super()._attendance_action_change()
46+
if "default_apply_holiday_overtime_factor" in self.env.context:
47+
result.write(
48+
{
49+
"apply_holiday_overtime_factor": self.env.context[
50+
"default_apply_holiday_overtime_factor"
51+
],
52+
}
53+
)
54+
return result

verdigado_attendance/static/src/js/hr_attendance.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,17 @@ odoo.define("verdigado_attendance.hr_attendance", function (require) {
1717
});
1818
return Promise.all([this._super.apply(this, arguments), promise]);
1919
},
20+
_rpc: function (params) {
21+
if (
22+
params &&
23+
params.model === "hr.employee" &&
24+
params.method === "attendance_manual"
25+
) {
26+
params.context.default_apply_holiday_overtime_factor = this.$(
27+
"#apply_holiday_overtime"
28+
).is(":checked");
29+
}
30+
return this._super.apply(this, arguments);
31+
},
2032
});
2133
});

verdigado_attendance/static/src/xml/hr_attendance.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
<div t-if="checked_in and widget.effective_holiday_overtime_factor != 1">
66
<input type="checkbox" id="apply_holiday_overtime" checked="" />
77
<label for="apply_holiday_overtime">
8-
Apply holiday overtime factor (
9-
<t t-out="widget.effective_holiday_overtime_factor" />
10-
)
8+
Apply holiday overtime factor
9+
<!-- prettier-ignore-start -->
10+
(<t t-out="widget.effective_holiday_overtime_factor" />)
11+
<!-- prettier-ignore-end -->
1112
</label>
1213
</div>
1314
</xpath>

0 commit comments

Comments
 (0)