[IMP] hr_payroll: Add leave type One2many on benefit type

Purpose
=======

Currently, linking a benefit type and a leave type is done through
the leave type form view.
This is anoying because it requires to first create the benfit type,
then go to the leave type and link it.
Moreover, linking is the role of a payroll manager which should be
able to do it from the Payroll app.

Specification
=============

Add a One2many field `leave_type_ids` on `hr.benefit.type` to
allow to link a leave type when creating a benefit type.
This commit is contained in:
Lucas Lefèvre
2019-03-19 09:35:31 +01:00
committed by Yannick Tivisse
parent 27da2eb070
commit ca5b1a8fe6
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -286,7 +286,7 @@ class HrWorkEnrty(models.Model):
return False
class HrWorkEnrtyType(models.Model):
class HrWorkEntryType(models.Model):
_name = 'hr.work.entry.type'
_description = 'hr.work.entry.type'
@@ -298,6 +298,8 @@ class HrWorkEnrtyType(models.Model):
'Active', default=True,
help="If the active field is set to false, it will allow you to hide the work entry type without removing it.")
is_leave = fields.Boolean(default=False, string="Leave")
leave_type_ids = fields.One2many('hr.leave.type', 'work_entry_type_id', string='Leave Type')
class Contacts(models.Model):
""" Personnal calendar filter """
@@ -163,10 +163,11 @@
<group>
<group>
<field name="code"/>
<field name="sequence"/>
</group>
<group>
<field name="is_leave"/>
<field name="sequence"/>
<field name="leave_type_ids" widget="many2many_tags" attrs="{'invisible': [('is_leave', '=', False)]}"/>
</group>
</group>
</sheet>