Skip to Content
Menú
This question has been flagged

Hello, 

I added a button to a form views dynamically and i'm trying to add a action function to that button dynamically.

This function need to be added to specific model.

this is an example of the function i want to run dynamically without writing this explicit code

def action_open_agreement(self):
self.ensure_one()
action = self.env.ref("agreement.agreement_action")
result = action.read()[0]
result["domain"] = [(self.res.field_name, "=", self.id)]
result["context"] = {
"default_" + self.res.field_name: self.id,
}
return result

  

if anyone already worked on this issue and can help, please leave a comment.

thank you.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de febr. 25
516
1
de març 21
4171
2
de maig 20
3008
3
de març 15
9181
0
de març 25
543