Reputation: 111
I added a boolean field to a openerp 7 form
at on_change
I call my method in order to change offer
field values on the form
my method returns:
{'value': {'fieldname': 'newfieldvalue'}}
I want replace the boolean field with a button, but my method don't work for buttons that is the right return value for a button in order to change field values on the same form.
Upvotes: 0
Views: 2810
Reputation: 2499
A button on a form always saves the form first (calls write on the model) and then executes the button method.
So, you will need to write a button method that writes the value into the field and then if you return True I think the form is redisplayed.
Have a look at the Calculate Taxes button on the customer or supplier invoice forms for an example.
Upvotes: 0
Reputation: 679
You can define a function for that button as follows :- let your field be 'checked'
def pass(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'checked': True})
Upvotes: 1