Adding custom Settings options
In Odoo, you can provide optional features through the Settings options. The user can enable or disable this option at any time. We will illustrate how to create Settings options in this recipe.
Getting ready
In previous recipes, we added buttons so that hostel users can click and return rooms. This is not the case for every hostel; however, we will create a Settings option to enable and disable this feature. We will do this by hiding these buttons. In this recipe, we will use the same my_hostel
module from the previous recipes.
How to do it...
To create custom Settings options, follow these steps:
- Add a new field by inheriting the
res.config.settings
model:class ResConfigSettings(models.TransientModel): Â Â Â _inherit = 'res.config.settings' Â Â Â group_hostel_user = fields.Boolean(string="Hostel User", implied_group='my_hostel.group_hostel_user')
- Add this field to the existing...