Odoo Help

0

create function openerp 6.0

By
Helmi Dhaoui
on 6/25/15, 10:17 AM 934 views


I created a module in openerp 6.0, the problem that openerp 6.0 did not support the same code as openerp 7, this is the function create: if some one can help me to solve the problem:

def create(self, cr, uid, vals, context=None):

if context is None:

context = {}

if vals['teacher_id']:

teacher=self.pool.get("res.partner").browse(cr,uid,vals['teacher_id'],context)

teacher.attendee=True

if vals['etudiant_ids'][0][2]:

for etudiant in self.pool.get("res.partner").browse(cr,uid,vals['etudiant_ids'][0][2],context):

etudiant.attendee=True

return super(attendee, self).create(cr, uid, vals, context=context)

the problem is in "if vals['etudiant_ids'][0][2]:"

if vals['etudiant_ids'][0][2]:

TypeError: 'bool' object has no attribute '__getitem__'

You cannot use teacher.attendee=True in OpenERP v6. Other than that, you must check vals.get('etudiant_ids') and proceed!

Serpent Consulting Services Pvt. Ltd.
on 6/26/15, 11:07 AM
0
Tom
On 6/26/15, 6:40 AM

Hi, i think you check the vals has the key 'etudiant_ids' and the the vals has vaule not yet


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/25/15, 10:17 AM
Seen: 934 times
Last updated: 6/26/15, 11:07 AM