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

Is it possible to the first parameter of a fields.related() to be a fields.many2many ?

By
Anabela Damas
on 6/25/14, 1:25 PM 651 views

hi, 

The code that I have is this : 

'class_ids': fields.many2many('class.class', 'discipline_class_rel', 'discipline_id', 'class_id', 'Class',),

 

'student_id': fields.related('class_ids','student', type="many2many", relation="res.partner", string="Student", store=True)

 

Is it possible to the first parameter ('class_ids') of a fields.related() to be a fields.many2many ? 

For some reason I get this error:

cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, get_pg_type(f)[1]))
TypeError: 'NoneType' object is unsubscriptable

Is it possible to do this ? 

Thanks

 

 

 

Maybe you could expand and explain better what Models you are using and how they relate between them. My suspicions is that you don't actually need a "fields.related"...

Daniel Reis
on 6/26/14, 7:07 AM

I used a workaround, thanks!

Versão Integral, Anabela Damas
on 7/3/14, 6:19 AM
0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 6/26/14, 5:04 AM

Hi

Try this code

'class_ids': fields.many2many('class.class', 'discipline_class_rel', 'discipline_id', 'class_id', 'Class',),
'student_id': fields.related('class_ids','student_id', type="many2many", relation="res.partner", string="Student")

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

2 follower(s)

Stats

Asked: 6/25/14, 1:25 PM
Seen: 651 times
Last updated: 3/16/15, 8:10 AM