X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=letriseratop.py;h=107fbedacf137eb448795c61932c576e8d3aee73;hb=7b2fab9b7034e1f40defb20b73a3265c88b2b1e3;hp=d4abae61c875934ed9e48e9c42331257d245207b;hpb=8cac769c165bdc0290f42317928297698175819e;p=burette%2Fletriseratop.git diff --git a/letriseratop.py b/letriseratop.py index d4abae6..107fbed 100644 --- a/letriseratop.py +++ b/letriseratop.py @@ -41,14 +41,12 @@ class Partner(orm.Model): def onchange_occupation_id(self, cr, uid, ids, occupation_id): """Define if a partner is a student based on his/her occupation type""" v = {} - partners = self.browse(cr, uid, ids) occupations = self.pool.get('bikecoop.partner.theme') occupation = occupations.browse(cr, uid, occupation_id) if occupation.type == 'studies': v['is_student'] = True else: v['is_student'] = False - v['is_scholarship'] = False return {'value': v} @@ -60,29 +58,12 @@ class Partner(orm.Model): string='Student?', type='boolean', store=True), - 'is_scholarship': fields.boolean('Scholarship', - help='Is this student a scholarship?'), 'want_to_be_volunteer': fields.boolean( 'Do you want to receive some informations about volunteer \ activities?', help='… in company and its activities: bikecoop, events, …'), } - 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']), - ] - class Theme(orm.Model): _inherit = 'bikecoop.partner.theme'