I have a transient model that serves as a dialog. In my form view I have a button like this:
yesterday I bumped on this same issue. I needed to show a button to do something without submitting the whole wizaard. I worked around it by not using a button at all. It's pretty simple and effective. What you need:
invisible="1" and a label to be styled as a buttonHere's the code:
source_it = fields.Boolean(string='Source')
[...]
def action_source(self):
# do stuff
@api.onchange('source_it')
def onchange_source_it(self):
if self.env.context.get('sourcing_now') or not self.source_it:
return
self.action_source()
[...]
The trick works because when a label has for attribute is going to act like the checkbox itself, so if you click on the label you are actually switching the checkbox.