跳至內容
選單
此問題已被標幟
2 回覆
4827 瀏覽次數

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?


頭像
捨棄
作者 最佳答案

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 




頭像
捨棄
最佳答案

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

   

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
9月 21
5571
1
7月 19
2984
3
9月 20
3178
3
12月 19
3101
1
11月 19
4857