From ca5b1a8fe63f627de5a9ff2ba2db98308b8464a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Mon, 4 Mar 2019 13:37:55 +0100 Subject: [PATCH] [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. --- addons/hr_payroll/models/hr_work_entry.py | 4 +++- addons/hr_payroll/views/hr_work_entry_views.xml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/hr_payroll/models/hr_work_entry.py b/addons/hr_payroll/models/hr_work_entry.py index a9950c2f608..2d218d3b7b5 100644 --- a/addons/hr_payroll/models/hr_work_entry.py +++ b/addons/hr_payroll/models/hr_work_entry.py @@ -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 """ diff --git a/addons/hr_payroll/views/hr_work_entry_views.xml b/addons/hr_payroll/views/hr_work_entry_views.xml index eb23d506ad3..deb3e89fd52 100644 --- a/addons/hr_payroll/views/hr_work_entry_views.xml +++ b/addons/hr_payroll/views/hr_work_entry_views.xml @@ -163,10 +163,11 @@ + - +