Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions addons/hr/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,7 @@ def _compute_legal_name(self):
@api.depends('current_version_id')
@api.depends_context('version_id')
def _compute_version_id(self):
context_version_id = self.env.context.get('version_id', False)
context_version = self.env['hr.version'].browse(context_version_id).exists() if context_version_id else self.env['hr.version']
context_version = self.env['hr.version'].browse(self.env.context.get('version_id', False))

for employee in self:
if context_version.employee_id == self:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<t t-name="hr.ButtonNewContract">
<span class="w-100 d-flex justify-content-end">
<button class="btn btn-link p-0 o_field_widget text-end w-auto" t-on-click="onClickNewContractBtn"
t-ref="datetime-picker-target-new-contract" t-if="props.record.resId and props.record.data.contract_date_start">New Contract</button>
t-ref="datetime-picker-target-new-contract" t-if="props.record.resId">New Contract</button>
</span>
</t>
</template>
21 changes: 0 additions & 21 deletions addons/hr/tests/test_hr_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,27 +523,6 @@ def test_multi_edit_other_and_contract_date_sync(self):
self.assertEqual(version.job_id.id, jobB.id)
self.assertEqual(version.contract_date_end, date(2020, 9, 30))

def test_delete_version(self):
employee = self.env['hr.employee'].create({
'name': 'John Doe',
'date_version': '2020-01-01',
})
v1 = employee.version_id
v2 = employee.create_version({
'date_version': '2021-01-01',
})
v3 = employee.create_version({
'date_version': '2022-01-01',
})
self.assertEqual(employee.current_version_id, v3)

v3.unlink()
self.assertEqual(employee.current_version_id, v2)
v1.unlink()
self.assertEqual(employee.current_version_id, v2)
with self.assertRaises(ValidationError):
v2.unlink()

def test_multi_edit_multi_employees_no_contract(self):
"""
Test the multi-edit when there is one version per employee, without contract
Expand Down
2 changes: 1 addition & 1 deletion addons/hr/views/hr_employee_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
<span invisible="not contract_date_start">to</span>
<field name="contract_date_end" string="End Date" placeholder="Indefinite"
class="o_hr_narrow_field ms-3" invisible="not contract_date_start"/>
<widget name="button_new_contract"/>
<widget name="button_new_contract" invisible="not contract_date_start"/>
</div>
<label for="wage"/>
<div class="o_row" name="wage">
Expand Down
5 changes: 3 additions & 2 deletions addons/hr_holidays/models/hr_leave_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,15 @@ def _search_max_leaves(self, operator, value):
return [('id', 'in', valid_leaves)]

def _search_virtual_remaining_leaves(self, operator, value):
def is_valid(leave_type):
return not leave_type.requires_allocation or op(leave_type.virtual_remaining_leaves, value)
op = PY_OPERATORS.get(operator)
if not op:
return NotImplemented
if operator != 'in':
value = float(value)
leave_types = self.env['hr.leave.type'].search([])

def is_valid(leave_type):
return not leave_type.requires_allocation or op(leave_type.virtual_remaining_leaves)
return [('id', 'in', leave_types.filtered(is_valid).ids)]

@api.depends_context('employee_id', 'default_employee_id', 'leave_date_from', 'default_date_from')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}

.o_accrual {
.o_field_accrual, .o_field_selection, .o_field_day_selection, .o_field_filterable_selection {
.o_field_accrual, .o_field_selection, .o_field_filterable_selection {
width: fit-content !important;

&:not(.o_readonly_modifier) > *:first-child {
Expand All @@ -20,7 +20,7 @@
field-sizing: content;
}

&:not(.o_field_selection, .o_field_day_selection, .o_field_filterable_selection) > *:first-child {
&:not(.o_field_selection, .o_field_filterable_selection) > *:first-child {
max-width: 8ch;
}
}
Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions addons/hr_holidays/views/hr_leave_accrual_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
</span>
<span name="biyearly" invisible="frequency != 'biyearly'">
on the
<field nolabel="1" name="first_month_day" class="o_field_accrual" widget="day_selection" month_field="first_month" placeholder="select a day" required="frequency == 'biyearly'"/>
<field nolabel="1" name="first_month_day" class="o_field_accrual" placeholder="select a day" required="frequency == 'biyearly'"/>
of
<field name="first_month" class="o_field_accrual" placeholder="select a month" required="frequency == 'biyearly'"/>
and the
<field nolabel="1" name="second_month_day" class="o_field_accrual" widget="day_selection" month_field="second_month" placeholder="select a day" required="frequency == 'biyearly'"/>
<field nolabel="1" name="second_month_day" class="o_field_accrual" placeholder="select a day" required="frequency == 'biyearly'"/>
of
<field nolabel="1" name="second_month" class="o_field_accrual" placeholder="select a month" required="frequency == 'biyearly'"/>
</span>
<span name="yearly" invisible="frequency != 'yearly'">
on the
<field nolabel="1" name="yearly_day" class="o_field_accrual" widget="day_selection" month_field="yearly_month" required="frequency == 'yearly'" placeholder="select a day"/>
<field nolabel="1" name="yearly_day" class="o_field_accrual" required="frequency == 'yearly'" placeholder="select a day"/>
of
<field nolabel="1" name="yearly_month" class="o_field_accrual" required="frequency == 'yearly'" placeholder="select a month"/>
</span>
Expand Down Expand Up @@ -192,7 +192,7 @@
options="{'links': {'other': 'carryover_custom_date'}, 'observe': 'carryover'}"/>
<span id="carryover_custom_date">
: the
<field name="carryover_day" widget="day_selection" month_field="carryover_month" placeholder="select a day"
<field name="carryover_day" placeholder="select a day"
required="carryover_date == 'other'"/>
of
<field name="carryover_month" placeholder="select a month"
Expand Down
24 changes: 24 additions & 0 deletions addons/hr_skills/report/hr_employee_certification_report_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,28 @@
</search>
</field>
</record>

<record id="hr_employee_certification_report_action" model="ir.actions.act_window">
<field name="name">Certification</field>
<field name="res_model">hr.employee.certification.report</field>
<field name="search_view_id" ref="hr_employee_certification_report_view_search"/>
<field name="view_mode">list,pivot</field>
<field name="context">{
'search_default_employee': 1,
}</field>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
</p><p>
This report will give you an overview of the certification per Employee.
Create them in configuration and add them on the Employee.
</p>
</field>
</record>

<menuitem
id="hr_employee_certification_report_menu"
name="Certifications"
action="hr_employee_certification_report_action"
parent="hr_skills.hr_employee_skill_report_menu"
sequence="25"/>
</odoo>
2 changes: 1 addition & 1 deletion addons/hr_skills/report/hr_employee_skill_report_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@
id="hr_employee_skill_inventory_report_menu"
name="Skills Inventory"
action="hr_employee_skill_report_action"
parent="hr.hr_menu_hr_reports"
parent="hr_skills.hr_employee_skill_report_menu"
sequence="15"/>
</odoo>
8 changes: 7 additions & 1 deletion addons/hr_skills/views/hr_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
<field name="res_model">hr.employee.skill</field>
<field name="path">certifications</field>
<field name="domain">[('is_certification', '=', True), ('company_id', 'in', allowed_company_ids)]</field>
<field name="context">{'show_employee': True}</field>
<field name="context">{'show_employee': True, 'search_default_group_by_type': 1}</field>
<field name="view_mode">list,form</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'list', 'view_id': False}),
Expand All @@ -609,6 +609,12 @@
sequence="7"
groups="hr.group_hr_user"/>

<menuitem
id="hr_employee_skill_report_menu"
name="Skills"
parent="hr.hr_menu_hr_reports"
sequence="15"/>

<menuitem
id="hr_skill_learning_menu"
name="Learning"
Expand Down