Skip to Content
Menu
This question has been flagged
2 Replies
1666 Views

Good evening my friends,


I have created a function which modify the "tension_min " values of records. This function is defined as follows:



@api.multi
def action_my_action3(self, cr, uid, ids=False, context=None):
for record in self.browse(cr, uid, ids, context=context):
tension_min = record.tension_min
self.write({'tension_min': (tension_min + 1)})
This function is applied from a button, which is defined in the xml file as follows:
<button name="action_my_action4" string="My Function2" type="object"/>
But when i click on this button , i get the following erreur :
" action_my_action3() takes at least 3 arguments (2 given) "
Avatar
Discard
Author Best Answer

Thank you Mouhamed, it work for me, but it modify only the current record. i want to modify all records in one click.

Thank you

Avatar
Discard
Best Answer

Hi,

@api.multi is used in new api only. Try to rewrite your function like this

@api.multi
def action_my_action3(self):
for record in self:
tension_min = record.tension_min
self.write({'tension_min': (tension_min + 1)})

Also I don't understand what you mean by the content of your function. If you define a button in form view self will contain record of that one file only.

So you just need to write self.tension_min = self.tension_min +1

Avatar
Discard