← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-bug-holidays_constraint-psi into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind

 

Purnendu Singh (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-holidays_constraint-psi into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-holidays_constraint-psi/+merge/58231

Hello,

Fixes:
Getting constraint error even the number of days is 1 "The number of days must be greater than 0 !"

spelling mistakes in help.

Thanks and regards
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-holidays_constraint-psi/+merge/58231
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-bug-holidays_constraint-psi into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind.
=== modified file 'hr_holidays/hr_holidays.py'
--- hr_holidays/hr_holidays.py	2011-04-18 11:04:37 +0000
+++ hr_holidays/hr_holidays.py	2011-04-19 05:55:52 +0000
@@ -122,9 +122,9 @@
         'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
         'holiday_status_id': fields.many2one("hr.holidays.status", "Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
         'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
-        #'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
+        #'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automatically filled by the user who validate the leave'),
         #'notes': fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
-        'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
+        'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True, help='This area is automatically filled by the user who validate the leave'),
         'notes': fields.text('Reasons',readonly=True, states={'draft':[('readonly',False)]}),
         'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}),
         'number_of_days': fields.function(_compute_number_of_days, method=True, string='Number of Days', store=True),
@@ -135,7 +135,7 @@
         'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True),
         'category_id': fields.many2one('hr.employee.category', "Category", help='Category of Employee'),
         'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category', required=True),
-        'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)')
+        'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automatically filled by the user who validate the leave with second level (If Leave type need second validation)')
     }
     _defaults = {
         'employee_id': _employee_get,
@@ -146,8 +146,8 @@
     }
     _sql_constraints = [
         ('type_value', "CHECK( (holiday_type='employee' AND employee_id IS NOT NULL) or (holiday_type='category' AND category_id IS NOT NULL))", "You have to select an employee or a category"),
-        ('date_check', "CHECK ( number_of_days_temp > 0 )", "The number of days must be greater than 0 !"),
-        ('date_check2', "CHECK ( (type='add') OR (date_from < date_to))", "The start date must be before the end date !")
+        ('date_check2', "CHECK ( (type='add') OR (date_from <= date_to))", "The start date must be before the end date !"),
+        ('date_check', "CHECK ( number_of_days_temp >= 0 )", "The number of days must be greater than 0 !"),
     ]
 
     def _create_resource_leave(self, cr, uid, vals, context=None):

=== modified file 'project/project.py'
--- project/project.py	2011-04-07 11:41:45 +0000
+++ project/project.py	2011-04-19 05:55:52 +0000
@@ -405,12 +405,6 @@
                  default.update({'name':new_name})
         return super(task, self).copy_data(cr, uid, id, default, context)
 
-    def _check_dates(self, cr, uid, ids, context=None):
-        task = self.read(cr, uid, ids[0], ['date_start', 'date_end'])
-        if task['date_start'] and task['date_end']:
-             if task['date_start'] > task['date_end']:
-                 return False
-        return True
 
     def _is_template(self, cr, uid, ids, field_name, arg, context=None):
         res = {}


Follow ups