1
votes

I have added a button to existing form of purchase order in Purchase order Line Tree. But i want to show that button only in edit mode. I tried:

<button name="adjust_received_qty" string="⇒ Adjust" type="object" class="oe_edit_only"/>

i tried to put class = oe_read_only, but it does not work in odoo 8.

Thanks,

UPDATE

My requirement is : i want to show the button when user clicks edit button. if i use the suggested approach, i will able to hide button in create view.but it will be visible in form view even in view mode. I want to show the button only in edit view ( when user clicks the edit button )

Please Help,

2
Hi danidee, that ticket is for field not buttonuser280960
fields and buttons are still odoo widgets, fundamentally there's no difference between themdanidee

2 Answers

4
votes

try class=oe_edit_only it's working fine for me

0
votes

Standard Odoo work must be using python+xml in general, and it's not recommended to use javascript long codes with it because it may cause performance problems.

I've not done this but I think you can achieve this using javascript and add on click event listener on edit button and use show()-hide() function on the fields/button which you want to hide/show so it may help you to solve this issue.

Maybe digging in deep odoo codes may give you another solutions who knows :D