I've read the docs and looked at the original source code for many examples, but can't seem to understand what the states="" do for a button? I originally thought this would be to only show the button in these states, but for that I see attrs="{'invisible'.. are used.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
Hi,
If the attribute states are used along with a button, then the button only will be visible in the given state.
See the sample,
<button string="Confirm" type="object" name="confirm_resignation"
states='draft' class="oe_highlight"/>
Now this confirm button will only visible in the state draft.
To hide the button based on multiple conditions, like based state and some other field value,
<button name="invoice_print" string="Print Receipt" type="object"
attrs="{'invisible':['|',('sent','=',False), ('state', 'not in', ('open','paid'))]}"
groups="base.group_user"/>
If we simultaneously give attrs and states, states won't work. That's why states are given inside attrs
Thanks
+1
Thanks! And +2 for explaining that last bit, that's exactly why I didnt get the expected behaviour (I was using states and attrs invisible
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
Opening new window with button in OpenERP
Diselesaikan
|
|
1
Jan 24
|
14261 | |
|
4
Mar 20
|
2841 | ||
|
2
Mar 18
|
5066 | ||
|
0
Jan 18
|
3181 | ||
|
2
Feb 24
|
25638 |