Skip to Content
Menu
This question has been flagged
2 Replies
9986 Views

Hello

I have many2many field :  

capture_ref = fields.Many2many('affichage.information', string="Numéro de série", required=True)

And i want to get the record which have 'reference','=',self.capture_ref.reference :

rec = self.env['affichage.information'].search([('reference','=',self.capture_ref.reference)])


I get this erreur :  ValueError: Expected singleton: affichage.information(41, 42)

Avatar
Discard
Author Best Answer

Hi Mohammed , thank you for your help but it dosent work for me.

In rec there is two records yes, but i don't know how i will affect to these two record, one value.



Avatar
Discard
Best Answer

Hi,

I don't think error is in the line you gave. variable rec is having two records in it.

there is two record with 'reference','=',self.capture_ref.reference
so if you use rec.some_field please change it to 

for single_rec in rec:

     single_rec.some_field

Avatar
Discard