How it works...

The button's type attribute determines the semantics of the other fields, so we'll first look into the possible values:

  • action: This makes the button call an action as defined in the ir.actions.* namespace. The name attribute needs to contain the action's database ID, which you can conveniently have Odoo look up with a Python format string containing the XML ID of the action in question.
  • object: This calls a method of the current model. The name attribute contains the function's name. The function should have the @api.multi signature and will act on the currently viewed record.

The string attribute is used to assign the text the user sees.

There used to be a third value—workflow—which sent a signal to the by now deprecated and removed workflow engine. If you come across this when migrating code from older versions, you'll probably have to replace it by a method call.