Skip to content

Commit

Permalink
[MIG][hr_attendance_reason] Fix pre-commit issues (II)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTietze committed Nov 27, 2024
1 parent 3b4725a commit 11ce2d1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 33 deletions.
16 changes: 8 additions & 8 deletions hr_attendance_reason/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ class ResCompany(models.Model):
string="Required reason on attendance screen"
)
reason_on_attendance_screen_default_sign_in = fields.Many2one(
'hr.attendance.reason',
"hr.attendance.reason",
string="Default sign-in reason for attendance screen",
domain=[
('action_type', '=', 'sign_in'),
('show_on_attendance_screen', '=', True)
("action_type", "=", "sign_in"),
("show_on_attendance_screen", "=", True)
],
check_company=True
check_company=True,
)
reason_on_attendance_screen_default_sign_out = fields.Many2one(
'hr.attendance.reason',
"hr.attendance.reason",
string="Default sign-out reason for attendance screen",
domain=[
('action_type', '=', 'sign_out'),
('show_on_attendance_screen', '=', True)
("action_type", "=", "sign_out"),
("show_on_attendance_screen", "=", True)
],
check_company=True
check_company=True,
)
3 changes: 2 additions & 1 deletion hr_attendance_reason/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ class ResConfigSettings(models.TransientModel):
related="company_id.reason_on_attendance_screen_default_sign_in", readonly=False
)
reason_on_attendance_screen_default_sign_out = fields.Many2one(
related="company_id.reason_on_attendance_screen_default_sign_out", readonly=False
related="company_id.reason_on_attendance_screen_default_sign_out",
readonly=False
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ patch(ActivityMenu.prototype, {
longitude,
// CHANGE: add attendance reason as parameter to rpc call
attendance_reason_id: attendance_reason_param,
})
});
await this.searchReadEmployee();
},
async (err) => {
await rpc("/hr_attendance/systray_check_in_out", {
// CHANGE: add attendance reason as parameter to rpc call
attendance_reason_id: attendance_reason_param,
})
});
await this.searchReadEmployee();
},
{
Expand All @@ -65,7 +65,7 @@ patch(ActivityMenu.prototype, {
await rpc("/hr_attendance/systray_check_in_out", {
// CHANGE: add attendance reason as parameter to rpc call
attendance_reason_id: attendance_reason_param,
})
});
await this.searchReadEmployee();
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
t-ref="attendance_reason"
t-attf-class="o_hr_attendance_reason o_input_dropdown o_input o_field_widget {{ this.employee.required_reason_on_attendance_screen ? 'o_required_modifier' : '' }}"
>
<option value="0"/>
<option value="0" />
<t
t-foreach="this.employee.reasons"
t-as="reason"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<t t-set="employeeAvatarHeight" t-value="'60'" />
</t>
<h3 class="mt-2 mb-1">
<t t-esc="this.props.employeeData.employee_name"/>
<t t-esc="this.props.employeeData.employee_name" />
</h3>
<h5 class="text-muted my-0">
Please select a reason to
Expand Down
10 changes: 5 additions & 5 deletions hr_attendance_reason/static/src/public_kiosk/public_kiosk_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ patch(PublicKiosk.kioskAttendanceApp.prototype, {
this.attendance_reason_id !== "0" ? this.attendance_reason_id : "";

// Overwrite super method because we need to add the attendance reason to the rpc calls
const result = await this.makeRpcWithGeolocation('manual_selection', {
'token': this.props.token,
'employee_id': employeeId,
'pin_code': enteredPin,
'attendance_reason_id': attendance_reason_param,
const result = await this.makeRpcWithGeolocation("manual_selection", {
token: this.props.token,
employee_id: employeeId,
pin_code: enteredPin,
attendance_reason_id: attendance_reason_param,
});
if (result && result.attendance) {
this.employeeData = result;
Expand Down
20 changes: 10 additions & 10 deletions hr_attendance_reason/static/src/public_kiosk/public_kiosk_app.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t
t-name="public_kiosk_reason"
t-inherit="hr_attendance.public_kiosk_app"
t-inherit-mode="extension"
>
t-name="public_kiosk_reason"
t-inherit="hr_attendance.public_kiosk_app"
t-inherit-mode="extension"
>
<xpath expr="//CardLayout" position="inside">
<t t-if="this.state.active_display === 'reason'">
<KioskReason
employeeData="this.employeeData"
reasons="this.reasons"
pin_code="this.pin_code"
onReasonConfirm="(employee_id, pin_code, attendance_reason_id) => this.onReasonSelection(employee_id, pin_code, attendance_reason_id)"
onClickBack="() => this.kioskReturn()"
/>
employeeData="this.employeeData"
reasons="this.reasons"
pin_code="this.pin_code"
onReasonConfirm="(employee_id, pin_code, attendance_reason_id) => this.onReasonSelection(employee_id, pin_code, attendance_reason_id)"
onClickBack="() => this.kioskReturn()"
/>
<input t-ref="attendance_reason" type="hidden" />
</t>
</xpath>
Expand Down
11 changes: 7 additions & 4 deletions hr_attendance_reason/views/res_config_settings_view.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.hr.attendance.reason</field>
<field
name="name"
>res.config.settings.view.form.inherit.hr.attendance.reason</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="hr_attendance.res_config_settings_view_form" />
<field name="arch" type="xml">
Expand Down Expand Up @@ -32,9 +34,10 @@
/>
</div>
<div class="mt16 row">
<label for="reason_on_attendance_screen_default_sign_in"
string="Default value for sign-in"
class="o_light_label col-lg-4"
<label
for="reason_on_attendance_screen_default_sign_in"
string="Default value for sign-in"
class="o_light_label col-lg-4"
/>
<field
name="reason_on_attendance_screen_default_sign_in"
Expand Down

0 comments on commit 11ce2d1

Please sign in to comment.