+ def _check_occupation_is_not_studies(self, cr, uid, ids, context=None):
+ """Check if partners are students. If not, they can't be
+ scholarships."""
+ partners = self.browse(cr, uid, ids, context=context)
+ for partner in partners:
+ if partner.occupation_id.type != 'studies':
+ if partner.is_scholarship:
+ return False
+ return True
+
+ _constraints = [
+ (_check_occupation_is_not_studies, 'Error: This partner can\'t be a\
+ scholarship because s·he isn\'t a student.', ['is_scholarship']),
+ ]
+