Skip to content

Commit 6734863

Browse files
committed
[IMP] HR Onboarding
1 parent fbc616f commit 6734863

13 files changed

Lines changed: 137 additions & 79 deletions

File tree

addons/hr/models/hr_employee.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,7 @@ def _compute_split_legal_name(self):
679679
@api.depends('current_version_id')
680680
@api.depends_context('version_id')
681681
def _compute_version_id(self):
682-
context_version_id = self.env.context.get('version_id', False)
683-
context_version = self.env['hr.version'].browse(context_version_id).exists() if context_version_id else self.env['hr.version']
682+
context_version = self.env['hr.version'].browse(self.env.context.get('version_id', False))
684683

685684
for employee in self:
686685
if context_version.employee_id == self:

addons/hr/static/src/components/button_new_contract/button_new_contract.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<t t-name="hr.ButtonNewContract">
44
<span class="w-100 d-flex justify-content-end">
55
<button class="btn btn-link p-0 o_field_widget text-end w-auto text-nowrap" t-on-click="this.onClickNewContractBtn"
6-
t-ref="this.datetimePickerTargetRef" t-if="this.props.record.resId and this.props.record.data.contract_date_start">New Contract</button>
6+
t-ref="this.datetimePickerTargetRef" t-if="this.props.record.resId">New Contract</button>
77
</span>
88
</t>
99
</template>

addons/hr/tests/test_hr_version.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -523,27 +523,6 @@ def test_multi_edit_other_and_contract_date_sync(self):
523523
self.assertEqual(version.job_id.id, jobB.id)
524524
self.assertEqual(version.contract_date_end, date(2020, 9, 30))
525525

526-
def test_delete_version(self):
527-
employee = self.env['hr.employee'].create({
528-
'name': 'John Doe',
529-
'date_version': '2020-01-01',
530-
})
531-
v1 = employee.version_id
532-
v2 = employee.create_version({
533-
'date_version': '2021-01-01',
534-
})
535-
v3 = employee.create_version({
536-
'date_version': '2022-01-01',
537-
})
538-
self.assertEqual(employee.current_version_id, v3)
539-
540-
v3.unlink()
541-
self.assertEqual(employee.current_version_id, v2)
542-
v1.unlink()
543-
self.assertEqual(employee.current_version_id, v2)
544-
with self.assertRaises(ValidationError):
545-
v2.unlink()
546-
547526
def test_multi_edit_multi_employees_no_contract(self):
548527
"""
549528
Test the multi-edit when there is one version per employee, without contract

addons/hr_holidays/models/hr_work_entry_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def _search_max_leaves(self, operator, value):
282282

283283
def _search_virtual_remaining_leaves(self, operator, value):
284284
def is_valid(work_entry_type):
285-
return not work_entry_type.requires_allocation or op(work_entry_type.virtual_remaining_leaves, value)
285+
return not work_entry_type.requires_allocation or op(work_entry_type.virtual_remaining_leaves)
286286
op = PY_OPERATORS.get(operator)
287287
if not op:
288288
return NotImplemented

addons/hr_holidays/static/src/components/accrual_level/accrual_levels.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111

1212
.o_accrual {
13-
.o_field_accrual, .o_field_selection, .o_field_day_selection, .o_field_filterable_selection {
13+
.o_field_accrual, .o_field_selection, .o_field_filterable_selection {
1414
width: fit-content !important;
1515

1616
&:not(.o_readonly_modifier) > *:first-child {
@@ -20,7 +20,7 @@
2020
field-sizing: content;
2121
}
2222

23-
&:not(.o_field_selection, .o_field_day_selection, .o_field_filterable_selection) > *:first-child {
23+
&:not(.o_field_selection, .o_field_filterable_selection) > *:first-child {
2424
max-width: 8ch;
2525
}
2626
}

addons/hr_holidays/static/src/components/day_selection/day_selection.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

addons/hr_holidays/views/hr_leave_accrual_views.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@
3636
</span>
3737
<span name="biyearly" invisible="frequency != 'biyearly'">
3838
on the
39-
<field nolabel="1" name="first_month_day" class="o_hr_narrow_field-3" widget="day_selection" month_field="first_month" placeholder="select a day" required="frequency == 'biyearly'"/>
39+
<field nolabel="1" name="first_month_day" class="o_hr_narrow_field-3" placeholder="select a day" required="frequency == 'biyearly'"/>
4040
of
4141
<field name="first_month" class="o_hr_narrow_field-5" placeholder="select a month" required="frequency == 'biyearly'"/>
4242
and the
43-
<field nolabel="1" name="second_month_day" class="o_hr_narrow_field-3" widget="day_selection" month_field="second_month" placeholder="select a day" required="frequency == 'biyearly'"/>
43+
<field nolabel="1" name="second_month_day" class="o_hr_narrow_field-3" placeholder="select a day" required="frequency == 'biyearly'"/>
4444
of
4545
<field nolabel="1" name="second_month" class="o_hr_narrow_field-5" placeholder="select a month" required="frequency == 'biyearly'"/>
4646
</span>
4747
<span name="yearly" invisible="frequency != 'yearly'">
4848
on the
49-
<field nolabel="1" name="yearly_day" class="o_hr_narrow_field-3" widget="day_selection" month_field="yearly_month" required="frequency == 'yearly'" placeholder="select a day"/>
49+
<field nolabel="1" name="yearly_day" class="o_hr_narrow_field-3" required="frequency == 'yearly'" placeholder="select a day"/>
5050
of
5151
<field nolabel="1" name="yearly_month" class="o_hr_narrow_field-5" required="frequency == 'yearly'" placeholder="select a month"/>
5252
</span>
@@ -204,7 +204,7 @@
204204
options="{'links': {'other': 'carryover_custom_date'}, 'observe': 'carryover'}"/>
205205
<span id="carryover_custom_date">
206206
: the
207-
<field name="carryover_day" widget="day_selection" month_field="carryover_month" placeholder="select a day"
207+
<field name="carryover_day" placeholder="select a day"
208208
required="carryover_date == 'other'"/>
209209
of
210210
<field name="carryover_month" placeholder="select a month"

addons/hr_skills/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
'data/ir_actions_server_data.xml',
2323
'data/ir_cron_data.xml',
2424
'data/report_paperformat.xml',
25+
'report/hr_employee_certification_report_views.xml',
2526
'report/hr_employee_skill_history_report_views.xml',
2627
'report/hr_employee_skill_report_views.xml',
2728
'report/hr_employee_cv_report.xml',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Part of Odoo. See LICENSE file for full copyright and licensing details.
22

3+
from . import hr_employee_certification_report
34
from . import hr_employee_cv_report
45
from . import hr_employee_skill_history_report
56
from . import hr_employee_skill_report
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+
from odoo import fields, models, tools
4+
5+
6+
class HrEmployeeCertificationReport(models.BaseModel):
7+
_name = 'hr.employee.certification.report'
8+
_auto = False
9+
_inherit = ["hr.manager.department.report"]
10+
_description = 'Employee Certification Report'
11+
_order = 'employee_id, level_progress desc'
12+
13+
company_id = fields.Many2one('res.company', readonly=True)
14+
department_id = fields.Many2one('hr.department', readonly=True)
15+
16+
skill_id = fields.Many2one('hr.skill', readonly=True)
17+
skill_type_id = fields.Many2one('hr.skill.type', readonly=True)
18+
skill_level = fields.Char(readonly=True)
19+
level_progress = fields.Float(readonly=True, aggregator='avg')
20+
active = fields.Boolean(readonly=False)
21+
22+
def init(self):
23+
tools.drop_view_if_exists(self.env.cr, self._table)
24+
25+
self.env.cr.execute("""
26+
CREATE OR REPLACE VIEW %(table)s AS (
27+
SELECT
28+
row_number() OVER () AS id,
29+
e.id AS employee_id,
30+
e.company_id AS company_id,
31+
v.department_id AS department_id,
32+
s.skill_id AS skill_id,
33+
s.skill_type_id AS skill_type_id,
34+
sl.level_progress / 100.0 AS level_progress,
35+
sl.name AS skill_level,
36+
(s.valid_to IS NULL OR s.valid_to >= '%(date)s') AND s.valid_from <= '%(date)s' AS active
37+
FROM hr_employee e
38+
LEFT JOIN hr_version v ON e.current_version_id = v.id
39+
LEFT OUTER JOIN hr_employee_skill s ON e.id = s.employee_id
40+
LEFT OUTER JOIN hr_skill_level sl ON sl.id = s.skill_level_id
41+
LEFT OUTER JOIN hr_skill_type st ON st.id = sl.skill_type_id
42+
WHERE e.active AND st.active IS True AND st.is_certification IS TRUE
43+
)
44+
""" % {
45+
'table': self._table,
46+
'date': fields.Date.context_today(self)
47+
})

0 commit comments

Comments
 (0)