Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
4796 Vizualizări

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?


Imagine profil
Abandonează
Autor Cel mai bun răspuns

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 




Imagine profil
Abandonează
Cel mai bun răspuns

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

   

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
sept. 21
5525
1
iul. 19
2944
3
sept. 20
3134
3
dec. 19
3063
1
nov. 19
4811