Skip to Content
Menu
This question has been flagged
1 Reply
2768 Views

How do i remove Preview Button in draft Invoice \https://imgur.com/a/dH8h0Jv

Avatar
Discard
Best Answer

Hi,

You can add one more condition to the corresponding button, if you activate the developer mode and if you click the Debugger button -> Edit: View Form, you can see the code of corresponding views, from it you can see the Preview Button,

<!-- Preview (only customer invoices) -->
<button name="preview_invoice" type="object" string="Preview"
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund'))]}"/>


So by default there is a condition to make the button invisible , so you have to add one more condition into it,

attrs="{'invisible': ['|', ('type', 'not in', ('out_invoice', 'out_refund')), ('state', '=', 'draft')]}"


This will make the button invisible in the draft state. Right now i have shown it by editing the code from UI/source code, you can apply same logic via custom module.




Thanks

Avatar
Discard
Author

hi, thanks for helping

i know how to activate developer mode but i can't find 'click the Debugger button -> Edit: View Form'

Make sure that you are admin or able to access tech features, for activating debug mode: https://www.youtube.com/watch?v=sRc4xYPza7g

Author

Thanks a lot . it worked!

Author

Hi, how can I disable print in draft invoice. (so many print button in odoo -.-)

https://imgur.com/a/nRs0eHD I want to disable my employee printing and deleting draft invoice.

Please help.