diff options
| author | len-odoo <len@odoo.com> | 2018-04-25 15:38:20 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2018-04-26 15:13:38 +0200 |
| commit | ab179bb2d7b8f890e04ea79e70d7bc0898e7599f (patch) | |
| tree | 55d47b9a2422e8f430eded44f1ed013faa2b1cc6 /addons/fleet/__manifest__.py | |
| parent | e67b61811bc01fad467545dc8896d754dc39506a (diff) | |
[IMP] base: Add compute/inverse methods to manage user groups
Purpose
=======
Allow to define users groups on a res.user with computed fields based on the 'groups_id' field.
Specification
=============
Add compute/inverse methods to manage specific groups on a res.users.
These methods should be used on fields defined like one the following cases:
1. A boolean field with the compute/inverse method and an attribute group_xml_id.
Example:
has_group_discount_per_so_line = fields.Boolean(
"Discount on lines",
compute='_compute_groups_id', inverse='_inverse_groups_id',
group_xml_id='sale.group_discount_per_so_line')
2. A selection field with the compute/inverse method, the selection got from '_get_group_selection'
and an attribute 'category_xml_id'
Example:
group_sales_team_user = fields.Selection(
selection=lambda self: self._get_group_selection('base.module_category_sales_management'),
string="Sales", compute='_compute_groups_id', inverse='_inverse_groups_id',
category_xml_id='base.module_category_sales_management')
The fields will be set according to the groups defined in the 'groups_id' field, and the 'groups_id'
field will be modified according to the modifications made on theses fields when saving the users's
form.
Diffstat (limited to 'addons/fleet/__manifest__.py')
0 files changed, 0 insertions, 0 deletions
