Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
4721 Vistas

This code works perfectly:

prod_obj = self.env['product.template'] 
new_dict = product.read(list(set(prod_obj._fields)))

How to return only fields where state = manual?


Avatar
Descartar
Autor Mejor respuesta

I'm getting error:

ValueError: Invalid field 'state' in leaf "<osv.ExtendedLeaf: ('state', '=', 'manual') on product_template (ctx: )>"

I add a custom field in ir.model.fields to product.template.

In model product.template i want create dict only from custom fields 




Avatar
Descartar
Mejor respuesta

Hello Popeye,

Here you can use read_group() when you you want to apply domain.
self.env['product.template'].read_group([('state', '=', 'manual')], ['state'], ['state'])


Regards,




Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
sept 21
5437
1
jul 19
2887
3
sept 20
3028
3
dic 19
2994
1
nov 19
4749