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

Creating or modifying templates - QWeb


We'll add website capabilities to the library addon developed in Chapter 4, Application models, and following. What we're interested in is allowing users to browse through the library and, if they are logged in with the appropriate permissions, enable them to edit book content right from the website interface.

Getting ready

As we make use of the library.book model, get chapter 4's code for my_module. For convenience, this recipe's code contains a copy of it.

How to do it...

We'll need to define a couple of controllers and views:

  1. Add a template that displays a list of books in views/library_book_templates.xml.

    <odoo>
      <template id="books">
        <t t-call="website.layout">
            <section>
                This is an editable text before the list of books.
            </section>
            <t t-foreach="books" t-as="book">
                <article itemscope="itemscope"
                         itemtype="http://schema.org/Book"
             ...