Enabling the archive option for records
Odoo provides inbuilt features to enable archive and unarchive options for records. This will help the user to hide records that are no longer important. In this recipe, we will add an archive/unarchive option for a book. We can archive a book once it is not available.
For this recipe, we will be using the
my_library module from the previous recipe.
How to do it...
Archive and unarchive mostly work automatically. The options are available on a record if the model has a Boolean field named
active. We already have an
active field in the
library.book model. But if you have not added it, follow these steps to add the
- Add an
activeBoolean field to the
library.bookmodel like this:
active = fields.Boolean(default=True)
- Add an
activefield in the form view:
<field name="active" invisible="1"/>
my_library module to apply the changes. Now, you will be able...