Skip to Content
Menu
This question has been flagged
1 Reply
15035 Views

I have created this function which modify the "approved_by" field of the corresponding reference :

@api.multi
def affecter_cap(self):
self.texto = self.list_fermes.farm_name
rec = self.env['affichage.information'].search(['reference','=',self.capture_ref.reference])
rec.approved_by = self.list_fermes.farm_name


I got this erreor when i click in the button which realise this action :  ValueError: Invalid leaf reference



Avatar
Discard
Author

Thank you Niyas

Best Answer

Hi Zak,

The problem is with this line, please rewrite the line like this,

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

add a ( ) in the search method.

Thanks

Avatar
Discard