Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I've set my order_line to be editable and want to remove the delete button if it's not in draft mode. I attempted the following but the delet button remains:
<xpath expr="//field[@name='order_line']//tree" position="attributes">
<attribute name="delete" domain="[(parent.state,'!=','draft')]"/>
Is it possible to dynamically set delete=false based on the draft state of the parent?
Well, I know that this question is a bit old, but still I am going to try and answer it.
From what I have search on the Internet, it seems that there is no support for what you want directly.
What I had to do was in the case of the form view, put in the <form> element delete=false, and add in the form <header> a button calling "unlink" that appears only when the state=draft.
And for the tree, I enabled the delete=true, and I have overwritten in my class the unlink method, to ensure that it is not called on records that have the state != draft.
So it always appear in the more, but it cannot be used on records I don't enable.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 10/26/14, 4:00 AM|
|Seen: 755 times|
|Last updated: 3/16/15, 8:10 AM|