From dbd6fb4e8c43ac0f7b406eebedcaa5d6da56a142 Mon Sep 17 00:00:00 2001 From: jbm-odoo Date: Thu, 21 Feb 2019 16:18:48 +0000 Subject: [PATCH] [IMP] l10n_be_hr_payroll: manage credit time during contract In Belgium, we have the concept of time credit and parental leaves. Globally the person keep full time rights and the initial contract is always signed on a full time basis. But an avenant with the new time schedule must be signed. A new wizard on contract allows to manage credit time. We can specify the start and stop date, the new calendar and the work time ratio. The new wage will be computed. After validation, the current contract will be duplicate two times, one modified for the time credit contract and the second for after the time credit period. The current contract will have end date at the beginnig of the time credit period. TaskID: 1924200 --- addons/hr_contract/models/hr_contract.py | 2 ++ .../hr_contract/views/hr_contract_views.xml | 1 + addons/resource/models/resource.py | 29 +++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/addons/hr_contract/models/hr_contract.py b/addons/hr_contract/models/hr_contract.py index bf1c5fbd58f..f41d4faba71 100644 --- a/addons/hr_contract/models/hr_contract.py +++ b/addons/hr_contract/models/hr_contract.py @@ -86,6 +86,8 @@ class Contract(models.Model): visa_expire = fields.Date('Visa Expire Date', related="employee_id.visa_expire", readonly=False) reported_to_secretariat = fields.Boolean('Social Secretariat', help='Green this button when the contract information has been transfered to the social secretariat.') + hr_responsible_id = fields.Many2one('res.users', 'HR Responsible', tracking=True, + help='Person responsible for validating the employee\'s contracts.') def _expand_states(self, states, domain, order): return [key for key, val in type(self).state.selection] diff --git a/addons/hr_contract/views/hr_contract_views.xml b/addons/hr_contract/views/hr_contract_views.xml index 5f42ca22720..fc6039361a3 100644 --- a/addons/hr_contract/views/hr_contract_views.xml +++ b/addons/hr_contract/views/hr_contract_views.xml @@ -131,6 +131,7 @@ + diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py index 2c1db4a5bd3..717fa0faae0 100644 --- a/addons/resource/models/resource.py +++ b/addons/resource/models/resource.py @@ -151,29 +151,28 @@ class ResourceCalendar(models.Model): res = super(ResourceCalendar, self).default_get(fields) if not res.get('name') and res.get('company_id'): res['name'] = _('Working Hours of %s') % self.env['res.company'].browse(res['company_id']).name + if not res.get('attendance_ids'): + res['attendance_ids'] = [ + (0, 0, {'name': _('Monday Morning'), 'dayofweek': '0', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), + (0, 0, {'name': _('Monday Afternoon'), 'dayofweek': '0', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), + (0, 0, {'name': _('Tuesday Morning'), 'dayofweek': '1', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), + (0, 0, {'name': _('Tuesday Afternoon'), 'dayofweek': '1', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), + (0, 0, {'name': _('Wednesday Morning'), 'dayofweek': '2', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), + (0, 0, {'name': _('Wednesday Afternoon'), 'dayofweek': '2', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), + (0, 0, {'name': _('Thursday Morning'), 'dayofweek': '3', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), + (0, 0, {'name': _('Thursday Afternoon'), 'dayofweek': '3', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), + (0, 0, {'name': _('Friday Morning'), 'dayofweek': '4', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), + (0, 0, {'name': _('Friday Afternoon'), 'dayofweek': '4', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}) + ] return res - def _get_default_attendance_ids(self): - return [ - (0, 0, {'name': _('Monday Morning'), 'dayofweek': '0', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), - (0, 0, {'name': _('Monday Afternoon'), 'dayofweek': '0', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), - (0, 0, {'name': _('Tuesday Morning'), 'dayofweek': '1', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), - (0, 0, {'name': _('Tuesday Afternoon'), 'dayofweek': '1', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), - (0, 0, {'name': _('Wednesday Morning'), 'dayofweek': '2', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), - (0, 0, {'name': _('Wednesday Afternoon'), 'dayofweek': '2', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), - (0, 0, {'name': _('Thursday Morning'), 'dayofweek': '3', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), - (0, 0, {'name': _('Thursday Afternoon'), 'dayofweek': '3', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}), - (0, 0, {'name': _('Friday Morning'), 'dayofweek': '4', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), - (0, 0, {'name': _('Friday Afternoon'), 'dayofweek': '4', 'hour_from': 13, 'hour_to': 17, 'day_period': 'afternoon'}) - ] - name = fields.Char(required=True) company_id = fields.Many2one( 'res.company', 'Company', default=lambda self: self.env['res.company']._company_default_get()) attendance_ids = fields.One2many( 'resource.calendar.attendance', 'calendar_id', 'Working Time', - copy=True, default=_get_default_attendance_ids) + copy=True) leave_ids = fields.One2many( 'resource.calendar.leaves', 'calendar_id', 'Time Off') global_leave_ids = fields.One2many(