Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
4059 Weergaven

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

 

 

 

Avatar
Annuleer

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"...

Auteur

I used a workaround, thanks!

Beste antwoord

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")

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
mei 16
3108
0
mrt. 15
6869
2
mrt. 15
9620
2
mrt. 15
8012
1
mrt. 15
7504