April 2016
Beginner to intermediate
400 pages
9h 16m
English
Odoo has special support for monetary values related to a currency. Let's see how to use it in a Model.
The Monetary field was introduced in Odoo 9.0 and is not available in previous versions. If you are using Odoo 8.0, the float field type is your best alternative.
We will reuse the my_module addon module from Chapter 3, Creating Odoo Modules.
The monetary field needs a complementary currency field to store the currency for the amounts.
The my_module already has a models/library_book.py defining a basic Model. We will edit this to add the needed fields:
class LibraryBook(models.Model):
# ...
currency_id = fields.Many2one(
'res.currency', ...