Odoo Help

Welcome!

This community 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.

0

create function openerp 6.0

By
Helmi Dhaoui
on 6/25/15, 10:17 AM 539 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


Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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