[IMP:moved _check_dates function from module project_long_term to module project]
bzr revid: pap@tinyerp.co.in-20100120124410-gl06rvx06c4vo1xw
This commit is contained in:
parent
aa41d4010c
commit
a6909d0cc0
|
@ -324,13 +324,13 @@ class task(osv.osv):
|
|||
default['work_ids'] = []
|
||||
return super(task, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
def _check_date(self,cr,uid,ids):
|
||||
for res in self.browse(cr,uid,ids):
|
||||
if res.date_start and res.date_end:
|
||||
if res.date_start > res.date_end:
|
||||
return False
|
||||
return True
|
||||
|
||||
def _check_dates(self, cr, uid, ids):
|
||||
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
|
||||
|
||||
_columns = {
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the task without removing it."),
|
||||
'name': fields.char('Task summary', size=128, required=True),
|
||||
|
@ -380,6 +380,9 @@ class task(osv.osv):
|
|||
}
|
||||
_order = "sequence, priority, date_deadline, id"
|
||||
|
||||
_constraints = [
|
||||
(_check_dates, 'Error! task start-date must be lower then task end-date.', ['date_start', 'date_end'])
|
||||
]
|
||||
#
|
||||
# Override view according to the company definition
|
||||
#
|
||||
|
|
|
@ -125,17 +125,6 @@ class task(osv.osv):
|
|||
_columns = {
|
||||
'phase_id': fields.many2one('project.phase', 'Project Phase')
|
||||
}
|
||||
def _check_dates(self, cr, uid, ids):
|
||||
leave = self.read(cr, uid, ids[0],['date_start','date_end'])
|
||||
if leave['date_start'] and leave['date_end']:
|
||||
if leave['date_start'] > leave['date_end']:
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_dates, 'Error! task start-date must be lower then task end-date.', ['date_start', 'date_end'])
|
||||
]
|
||||
|
||||
task()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
Loading…
Reference in New Issue