Odoo has special support for monetary values related to a currency. Let's see how we can use this in a model.
We will reuse the my_library add-on module from Chapter 4, Creating Odoo Add-On Modules.
The monetary field needs a complementary currency field to store the currency for the amounts.
my_library already has models/library_book.py, which defines a basic model. We will edit this to add the required fields:
- Add the field to store the currency that is to be used: