diff options
| author | Yannick Tivisse <yti@odoo.com> | 2018-04-25 15:21:02 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2018-04-26 15:13:38 +0200 |
| commit | 99f497b390e680629dce3a7e2e282ada74ee9884 (patch) | |
| tree | 3eb22b0bdcbe3d9709246309ff0dd0e404d1d259 /addons/analytic | |
| parent | ab179bb2d7b8f890e04ea79e70d7bc0898e7599f (diff) | |
[IMP] *: Define groups on res.users models
The reified view on the res users will be dropped in the following commit.
The previous commit adds support to define each group as a computed field on the res users.
This commit defines:
- A boolean field for each 'isolated' res.group, i.e. a group in the hidden category.
- A selection field for each 'Application' res.group, i.e. a group in a application category.
Example:
- The group to manage pricelist in sales becomes a boolean field
- The groups project user/manager become a selection field
Diffstat (limited to 'addons/analytic')
| -rw-r--r-- | addons/analytic/__manifest__.py | 1 | ||||
| -rw-r--r-- | addons/analytic/models/__init__.py | 1 | ||||
| -rw-r--r-- | addons/analytic/models/res_users.py | 16 | ||||
| -rw-r--r-- | addons/analytic/views/res_users_views.xml | 20 |
4 files changed, 38 insertions, 0 deletions
diff --git a/addons/analytic/__manifest__.py b/addons/analytic/__manifest__.py index 74499219a64..392600a5850 100644 --- a/addons/analytic/__manifest__.py +++ b/addons/analytic/__manifest__.py @@ -19,6 +19,7 @@ that have no counterpart in the general financial accounts. 'security/analytic_security.xml', 'security/ir.model.access.csv', 'views/analytic_account_views.xml', + 'views/res_users_views.xml', ], 'demo': [ 'data/analytic_demo.xml', diff --git a/addons/analytic/models/__init__.py b/addons/analytic/models/__init__.py index d1fd64b96f8..2e5e553c626 100644 --- a/addons/analytic/models/__init__.py +++ b/addons/analytic/models/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import analytic_account +from . import res_users diff --git a/addons/analytic/models/res_users.py b/addons/analytic/models/res_users.py new file mode 100644 index 00000000000..f1363c0d123 --- /dev/null +++ b/addons/analytic/models/res_users.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = 'res.users' + + has_group_analytic_accounting = fields.Boolean( + 'Analytic Accounting', compute='_compute_groups_id', inverse='_inverse_groups_id', + group_xml_id='analytic.group_analytic_accounting') + + has_group_analytic_tags = fields.Boolean( + 'Analytic Accounting Tags', compute='_compute_groups_id', inverse='_inverse_groups_id', + group_xml_id='analytic.group_analytic_tags') diff --git a/addons/analytic/views/res_users_views.xml b/addons/analytic/views/res_users_views.xml new file mode 100644 index 00000000000..0d4b070cdaf --- /dev/null +++ b/addons/analytic/views/res_users_views.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<odoo> + <record id="res_users_view_form" model="ir.ui.view"> + <field name="name">res.users.form.analytic.inherit</field> + <field name="model">res.users</field> + <field name="inherit_id" ref="base.view_users_form"/> + <field name="arch" type="xml"> + <group name="technical" position="inside"> + <label for="has_group_analytic_accounting" colspan="3"/> + <div> + <field name='has_group_analytic_accounting' colspan="1" class="oe_inline"/> + </div> + <label for="has_group_analytic_tags" colspan="3"/> + <div> + <field name='has_group_analytic_tags' colspan="1" class="oe_inline"/> + </div> + </group> + </field> + </record> +</odoo> |
