Skip to Content
Menu
This question has been flagged
2 Replies
5031 Zobrazenia

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
Zrušiť
Autor Best Answer

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
Zrušiť
Best Answer

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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
2
sep 21
5779
1
júl 19
3163
3
sep 20
3366
3
dec 19
3281
1
nov 19
5008