Enabling the archive option for records
Odoo provides inbuilt features to enable archive and unarchive options for records. This will help the user hide records that are no longer important. In this recipe, we will add an archive/unarchive option for a room. We can archive a room once it is not available.
Getting started
For this recipe, we will be using the my_hostel
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 hostel.room
model. But if you have not added it, follow these steps to add the active
field:
- Add an
active
Boolean field to thehostel.room
model, like this:active = fields.Boolean(default=True)
- Add an
active
field to the form view:<field name="active" invisible="1"/>
Update the my_hostel
module to apply the changes. Now, you will be able to archive...