[REF]improvement of constraint from rev id : csn@openerp.com-20121120085452-pvvu2aamy2zthwo3 to an sql constraint
bzr revid: csn@openerp.com-20121120103738-fqgi10ucuw9ca735
This commit is contained in:
commit
6f489aeb9a
|
@ -470,14 +470,8 @@ 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']),
|
||||
]
|
||||
|
||||
_sql_constraints = [('membership_date_greater','check(membership_date_to >= membership_date_from)','Error ! Ending Date cannot be set before Beginning Date.')]
|
||||
_defaults = {
|
||||
'membership': False,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue