Is it possibly to use an on_change method based on a Product name (or any other field) to change or add fields in a view? I've been trying to read up on this and I can see that it's possible to return values to other fields, but I haven't found yet whether it's possible to change the view itself (temporarily). Thank you.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Hi,
Using onchange method its not possible to create new fields on the fly, but you change the values of existing fields of your model. If you have 3 fields for your model, say fieldA, fieldB, fieldC and you define onchange method for fieldA, depending on changing the value of fieldA, you can set the value of fieldB & fieldC, but not possible to create a new fieldD.
But its possible to create similar effects, by predefining the extra fields and make them hide or visible depending on the value of another field, say Product name or category etc. But for that you don't need to use onchange method, you can use the attribute attrs in the xml file for that extra fields. For eg:
<field name="fieldB" attrs="{'invisible': [('fieldA','=','Nate')]}" />
Onchange is dealing differently in old api and new api, which you can found in the documentation, but the functionality remains same. But I think if your need to is to create fields(by hide/show effect), you may use attrs. And if you need to set/change values of other fields based on another, you can use the onchange method.
Hope this helps.
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
Dynamic view in on_change function
แก้ไขแล้ว
|
|
3
มิ.ย. 15
|
6486 | |
|
1
มี.ค. 15
|
9702 | ||
Select multiple elements with XPath
แก้ไขแล้ว
|
|
5
ส.ค. 24
|
46584 | |
|
2
เม.ย. 24
|
2526 | ||
|
3
มิ.ย. 23
|
5738 |