Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
4865 Visninger

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
Kassér
Forfatter Bedste svar

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
Kassér
Bedste svar

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
2
sep. 21
5618
1
jul. 19
3024
3
sep. 20
3202
3
dec. 19
3142
1
nov. 19
4890