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

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
Discard
Author 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
Discard
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
Discard
Related Posts Replies Views Activity
2
Sep 21
4308
1
Jul 19
2032
3
Sep 20
1900
3
Dec 19
2133
1
Nov 19
3569