[FIX]: add date validation.

bzr revid: nco@tinyerp.com-20120706091608-f5o08ke6z84oilui
This commit is contained in:
Nimesh (Open ERP)
2012-07-06 14:46:08 +05:30
parent 84c6ee9a3b
commit eab2e225a2
+8 -1
View File
@@ -478,7 +478,14 @@ class Product(osv.osv):
'membership_date_from': fields.date('Date from', help='Date from which membership becomes active.'),
'membership_date_to': fields.date('Date to', help='Date until which membership remains active.'),
}
def _check_end_date(self, cr, uid, ids, context=None):
for membership in self.browse(cr, uid, ids, context=context):
if membership.membership_date_to < membership.membership_date_from:
return False
return True
_constraints = [
(_check_end_date, 'Error ! Ending Date cannot be set before Beginning Date.', ['membership_date_to']),
]
_defaults = {
'membership': False,
}