Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4226 มุมมอง

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

   

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ย. 21
4901
1
ก.ค. 19
2501
3
ก.ย. 20
2494
3
ธ.ค. 19
2549
1
พ.ย. 19
4099