Hi all,
I'd like to display date_order field in sale order tree view only when date_order is > create_date
I tried using attrs with this code in it
https://ibb.co/H2WzNPJ
but it always shows field (there are orders that meet the criteria and date_order is < create_date
I'm not sure if this is possible - could someone help please?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
It is best to create computational field that would compare the values and return the one that we need - credit goes to Kenly, stackoverflow profile that gave me answer here -> https://stackoverflow.com/questions/73374466/show-field-based-on-value-of-another-field/73375524#73375524
Create a compute boolean field and use that with the attrs
model.py:
show_date_order= fields.Boolean(compute="_compute_show_date_order")
@api.depends('date_order','create_date')
def _compute_show_date_order(self):
return self.date_order is > self.create_date
view.xml:
In the field for date_order add this->
attrs={'invisible':[('show_date_order','=',False)]}
I'm not sure if this is only partial answer - but I don't get it. If I create boolean field I can use it to conditionally trigger showing of date_order, is that what you had in mind?
You are right, Odoo forum sanitized and delete my last line(Apparently we cannot post <field />. Just add the attrs to the <field> for date_order
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
พ.ค. 24
|
1715 | ||
|
1
ต.ค. 24
|
1315 | ||
|
5
ส.ค. 24
|
2856 | ||
|
2
ก.ค. 19
|
3942 | ||
|
2
มี.ค. 15
|
5640 |