Skip to Content
Menu
This question has been flagged
2 Replies
4872 Rodiniai

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?


Portretas
Atmesti
Autorius 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 




Portretas
Atmesti
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

   

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
rugs. 21
5620
1
liep. 19
3033
3
rugs. 20
3204
3
gruod. 19
3147
1
lapkr. 19
4892