From d9cece2ef82f2848fa642d482e94c3baeba0691d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Maes?= Date: Mon, 7 Aug 2017 15:49:53 +0200 Subject: [PATCH] [IMP] project_timesheet_holidays: ease leave type configuration A leave type now generate timesheet by default. So the internal project/task are taken from the leave type company (a default value for the company has been added). To allow the hr leave manager to select a project, he should be alble to read the analytic account (otherwise, crash when calling name_get). Setting the default internal project/task is advanced, so hidden in debug mode on timesheet config. --- addons/hr_holidays/models/hr_holidays.py | 2 +- .../views/res_config_settings_views.xml | 26 ++++++++++--------- addons/project_timesheet_holidays/__init__.py | 16 ++++++++++++ .../__manifest__.py | 3 +++ .../models/hr_holidays.py | 12 +++++++-- .../security/ir.model.access.csv | 2 ++ 6 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 addons/project_timesheet_holidays/security/ir.model.access.csv diff --git a/addons/hr_holidays/models/hr_holidays.py b/addons/hr_holidays/models/hr_holidays.py index 59d942c2ff6..66f95b60946 100644 --- a/addons/hr_holidays/models/hr_holidays.py +++ b/addons/hr_holidays/models/hr_holidays.py @@ -61,7 +61,7 @@ class HolidaysType(models.Model): double_validation = fields.Boolean(string='Apply Double Validation', help="When selected, the Allocation/Leave Requests for this type require a second validation to be approved.") - company_id = fields.Many2one('res.company', string='Company') + company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.user.company_id) @api.multi def get_days(self, employee_id): diff --git a/addons/hr_timesheet/views/res_config_settings_views.xml b/addons/hr_timesheet/views/res_config_settings_views.xml index ff3ecd6292b..0bd2760e6ec 100644 --- a/addons/hr_timesheet/views/res_config_settings_views.xml +++ b/addons/hr_timesheet/views/res_config_settings_views.xml @@ -59,19 +59,21 @@ -

Leaves

-
-
-
- -
-
-