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

I have a tree view in a page on product.product object, the tree columns are "is_out_of_stock", "product_child_reference", "unit_price", 

I'm trying to make field "is_out_of_stock" editable while check/uncheck the box, and open the form view when I click on the other columns

Any suggestions for this case ?

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you Vasanth for your suggestion, in fact I've already tried this, and I got just the "is_out_of_stock" checkbox editabel, otherwise when I click on "product_child_reference" or "unit_price", I don't get the form view of the child product record, 

อวตาร
ละทิ้ง
ผู้เขียน

I've found another way to do it and IMHO, it's better, In fact I've added a button in the tree list, which call a method which trigger a on_change function, this last do a write on the current record and return a dictionary like {'value': {'is_out_of_stock': not current_is_out_of_stock}}

คำตอบที่ดีที่สุด

Hi, you can make the tree view as editable and make the required field as editable and other fields as readonly in the tree view using attrs,readonly ,etc

try this:

<tree string="Product" editable="bottom">

<field name="is_out_of_stock"/>

<field name="product_child_reference" readonly="1"/>

<field name="unit_price" readonly="1"/>

</tree>

อวตาร
ละทิ้ง

Thanks! It worked fine

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
พ.ค. 20
7574
0
มี.ค. 22
2117
1
มี.ค. 15
11111
3
เม.ย. 24
1841
2
เม.ย. 20
13079