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.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 10/26/14, 4:00 AM|
|Seen: 638 times|
|Last updated: 3/16/15, 8:10 AM|