Hello,
Can i please avoid calling the write method of the model when i click on a button ?
Thanks,
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
Can i please avoid calling the write method of the model when i click on a button ?
Thanks,
This is an old question, and the exact context is not given, still here's how I managed to achieve that in 12.0:
First, the button should look like a button but not be an actual button tag so Odoo won't attach a click listener to it:
<a class="btn btn-primary myapp-dothis" tabindex="0" role="button">Do this!</a>
tabindex is necessary for Bootstrap CSS to correctly apply, and role is to avoid XML validation warnings.
Then use your favorite way of attaching your event to the button. Could be an onclick attribute, or if your button is in a view used in a JS widget, use the events property:
const MyEditor = dialogs.FormViewDialog.extend({
events: {
'click .myapp-dothis': 'onDoItClick'
},
onDoItClick(ev) {
...
},
On which method you want to do this, can you explain your requirement?
Hello, When i click on any button in Openerp , it call before the write method of the model to save the record. I want only call the button function.