From 28313ab57422d1b35cec1031fcbce606dbe4cf37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Maes?= Date: Mon, 30 May 2016 17:17:29 +0200 Subject: [PATCH] [REM] hr_contract : remove unused file --- addons/hr_contract/base_action_rule.py | 36 -------------------------- 1 file changed, 36 deletions(-) delete mode 100644 addons/hr_contract/base_action_rule.py diff --git a/addons/hr_contract/base_action_rule.py b/addons/hr_contract/base_action_rule.py deleted file mode 100644 index 3b30bc389f2..00000000000 --- a/addons/hr_contract/base_action_rule.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from openerp.fields import Datetime -from openerp.osv import fields, osv - - -class base_action_rule(osv.Model): - """ Add resource and calendar for time-based conditions """ - _name = 'base.action.rule' - _inherit = ['base.action.rule'] - - _columns = { - 'trg_date_resource_field_id': fields.many2one( - 'ir.model.fields', 'Use employee work schedule', - help='Use the user\'s working schedule.', - ), - } - - def _check_delay(self, cr, uid, action, record, record_dt, context=None): - """ Override the check of delay to try to use a user-related calendar. - If no calendar is found, fallback on the default behavior. """ - if action.trg_date_calendar_id and action.trg_date_range_type == 'day' and action.trg_date_resource_field_id: - user = record[action.trg_date_resource_field_id.name] - if user.employee_ids and user.employee_ids[0].contract_id \ - and user.employee_ids[0].contract_id.working_hours: - calendar = user.employee_ids[0].contract_id.working_hours - start_dt = Datetime.from_string(record_dt) - resource_id = user.employee_ids[0].resource_id.id - action_dt = self.pool['resource.calendar'].schedule_days_get_date( - cr, uid, calendar.id, action.trg_date_range, - day_date=start_dt, compute_leaves=True, resource_id=resource_id, - context=context - ) - return action_dt - return super(base_action_rule, self)._check_delay(cr, uid, action, record, record_dt, context=context)