Book Image

Odoo Development Cookbook

By : Holger Brunn, Alexandre Fayolle, Daniel Reis
Book Image

Odoo Development Cookbook

By: Holger Brunn, Alexandre Fayolle, Daniel Reis

Overview of this book

Odoo is a full-featured open source ERP with a focus on extensibility. The flexibility and sustainability of open source is also a key selling point of Odoo. It is built on a powerful framework for rapid application development, both for back-end applications and front-end websites. The book starts by covering Odoo installation and administration, and provides a gentle introduction to application development. It then dives deep into several of the areas that an experienced developer will need to use. You’ll learn implement business logic, adapt the UI, and extend existing features.
Table of Contents (23 chapters)
Odoo Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Adding buttons to forms


We added a button in the previous form, but there are quite different types of buttons to use. This recipe will add another button; also put the following code in to the previous recipe's header element.

How to do it...

Add a button referring to an action:

<button type="action" name="%(base.action_partner_category_form)d" string="Open partner categories" />

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 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 signature @api.multi and will act on the currently viewed record.

  • workflow: This sends a workflow...