[Fix] hr_contract: In hr contract, shouldn't be able to enter an end date lower than a start date
lp bug: https://launchpad.net/bugs/692962 fixed bzr revid: psi@tinyerp.co.in-20101221132641-sk4a6s07ye3s9d6k
This commit is contained in:
parent
d9ade7b4f6
commit
9deb75b765
|
@ -114,6 +114,19 @@ class hr_contract(osv.osv):
|
|||
'date_start': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
def _check_dates(self, cr, uid, ids, context=None):
|
||||
for contract in self.read(cr, uid, ids, ['date_start', 'date_end'], context=context):
|
||||
if contract['date_start'] and contract['date_end']:
|
||||
if contract['date_start'] > contract['date_end']:
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_dates, 'Error! contract start-date must be lower then contract end-date.', ['date_start', 'date_end'])
|
||||
]
|
||||
|
||||
|
||||
|
||||
hr_contract()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue