Module purpose
- This is a technical module that serves as a base for developing domain-restricted selection fields
- This module allows to add a domain for selection fields as selection options are itself records in ir.model.fields.selection model
- With this feature, you can restrict the choices in the dropdown menu of any Selection field
Installation
- Install module cs_selection_domain.
- Module should be compatible with the your version of Odoo. On install, a window will pop up identifying if the version is not compatible.
- All module dependencies should be available. On install, a window will pop up identifying if there is any missing dependency. You can obtain the missing dependency from Odoo App Store (https://apps.odoo.com/apps/modules/browse?author=Cloudia) or from Cloudia App Store (https://cloudia.systems/shop)
- All python dependencies should be available. On install, a window will pop up identifying if there is any missing dependency. Please install from Shell using 'pip3 install <dependency name>'.
- This module is designed to make these tests before installing itself, so it is safe to perform the above test installation. If all tests are passed, then the module will proceed to install itself.
Module Use
- Add this module as a dependency of the module in which you would like to set the domain on selection fields
- Inherit Class cs.selection.mixin in the model that contains the selection field(s) that requires a domain
- Include an onchange decorated method to set options to remove on certain action. Add an invisible field named selection_to_update in form view in order to allow the onchange decorated method to update the domain field