I want to remove the edit button on the purchase.order view when the state is 'purchase'.
I have a big problem with the bounce effect on the edit button. It's located in here:
\https://github.com/odoo/odoo/blob/10.0/addons/web/static/src/js/views/form_view.js
// Add bounce effect on button 'Edit' when click on readonly page view. this.$(".oe_title,.o_group").on('click', function (e) { if(self.get("actual_mode") === "view" && self.$buttons && !$(e.target).is('[data-toggle]')) { self.$buttons.find(".o_form_button_edit").openerpBounce(); core.bus.trigger('click', e); } });
I have made a module to hide the 'edit' button on the state purchase. Inside my javascript, I have this to handle that:
if (this.model=='purchase.order'){ if (this.get_fields_values().state=='purchase'){ this.$buttons.find('.o_form_button_edit').hide(); } else{ this.$buttons.find('.o_form_button_edit').show(); } var self = this; this.$(".oe_title,.o_group").on('click', function (e) { if(self.get("actual_mode") === "view" && self.$buttons && !$(e.target).is('[data-toggle]')) { self.$buttons.find(".o_form_button_edit").hide(); //core.bus.trigger('click', e); } }); }
Here I hide it with the if/else part, then I try to remove the bounce effect.
The problem is that when you click on any part at the form, the edit button shows up because of that bounce effect.
Is there any solution for this?
Thank you very much.