Try using _constraints.
def _check_batch_limit(self, cursor, user, ids, context=None):
for record in self.browse(cursor, user, ids, context=context):
//limit is set as 18 or 20
if len(record.student_registrations) > record.limit:
_constraints = [
(_check_batch_limit, 'Error:Limit reached.', ['student_registrations']),
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 12/8/14, 2:48 PM|
|Seen: 2074 times|
|Last updated: 3/16/15, 8:10 AM|