Browse Source
[IMP] base_user_role - Bump module version to '9.0.1.0.0'
[IMP] base_user_role - Bump module version to '9.0.1.0.0'
[IMP] base_user_role - Replace '<openerp>' tags by '<odoo>' + Remove useless '<data>' tags + Reindent XML content [FIX] base_user_role - Fix noupdate declaration [REM] base_user_role - Remove old migration scriptpull/641/head
sebalix
8 years ago
5 changed files with 107 additions and 138 deletions
-
2base_user_role/__openerp__.py
-
28base_user_role/data/ir_cron.xml
-
25base_user_role/migrations/8.0.1.1.0/post-migration.py
-
126base_user_role/views/role.xml
-
64base_user_role/views/user.xml
@ -1,20 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2016 ABF OSIELL <http://osiell.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
<openerp> |
|||
<data noupdate="1"> |
|||
<odoo noupdate="1"> |
|||
|
|||
<record model="ir.cron" id="cron_update_users"> |
|||
<field name='name'>Update user roles</field> |
|||
<field name='interval_number'>3</field> |
|||
<field name='interval_type'>hours</field> |
|||
<field name="numbercall">-1</field> |
|||
<field name="active">True</field> |
|||
<field name="doall" eval="False" /> |
|||
<field name="model">res.users.role</field> |
|||
<field name="function">cron_update_users</field> |
|||
<field name="args">()</field> |
|||
</record> |
|||
<record model="ir.cron" id="cron_update_users"> |
|||
<field name='name'>Update user roles</field> |
|||
<field name='interval_number'>3</field> |
|||
<field name='interval_type'>hours</field> |
|||
<field name="numbercall">-1</field> |
|||
<field name="active">True</field> |
|||
<field name="doall" eval="False" /> |
|||
<field name="model">res.users.role</field> |
|||
<field name="function">cron_update_users</field> |
|||
<field name="args">()</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
|||
</odoo> |
@ -1,25 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 ABF OSIELL <http://osiell.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
from openerp import api, SUPERUSER_ID |
|||
|
|||
|
|||
def migrate_res_users_role(env): |
|||
"""Migrate user roles database schema. |
|||
('res_users_role_user_rel' many2many table to 'res.users.role.line' model. |
|||
""" |
|||
role_line_model = env['res.users.role.line'] |
|||
query = "SELECT role_id, user_id FROM res_users_role_user_rel;" |
|||
env.cr.execute(query) |
|||
rows = env.cr.fetchall() |
|||
for row in rows: |
|||
vals = { |
|||
'role_id': row[0], |
|||
'user_id': row[1], |
|||
} |
|||
role_line_model.create(vals) |
|||
|
|||
|
|||
def migrate(cr, version): |
|||
env = api.Environment(cr, SUPERUSER_ID, {}) |
|||
migrate_res_users_role(env) |
@ -1,73 +1,71 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2014 ABF OSIELL <http://osiell.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
<openerp> |
|||
<data> |
|||
<odoo> |
|||
|
|||
<record id="view_res_users_role_form" model="ir.ui.view"> |
|||
<field name="name">res.users.role.form</field> |
|||
<field name="model">res.users.role</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Role" version="7.0"> |
|||
<sheet> |
|||
<group> |
|||
<field name="name"/> |
|||
<field name="group_id" required="0" readonly="1"/> |
|||
</group> |
|||
<notebook> |
|||
<page string="Groups"> |
|||
<field name="implied_ids" nolabel="1"/> |
|||
</page> |
|||
<page string="Users"> |
|||
<field name="line_ids" nolabel="1"> |
|||
<tree editable="bottom" colors="grey: not is_enabled;"> |
|||
<field name="user_id"/> |
|||
<field name="date_from"/> |
|||
<field name="date_to"/> |
|||
<field name="is_enabled"/> |
|||
</tree> |
|||
</field> |
|||
</page> |
|||
</notebook> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_res_users_role_tree" model="ir.ui.view"> |
|||
<field name="name">res.users.role.tree</field> |
|||
<field name="model">res.users.role</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Role"> |
|||
<record id="view_res_users_role_form" model="ir.ui.view"> |
|||
<field name="name">res.users.role.form</field> |
|||
<field name="model">res.users.role</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Role" version="7.0"> |
|||
<sheet> |
|||
<group> |
|||
<field name="name"/> |
|||
<field name="user_ids"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
<field name="group_id" required="0" readonly="1"/> |
|||
</group> |
|||
<notebook> |
|||
<page string="Groups"> |
|||
<field name="implied_ids" nolabel="1"/> |
|||
</page> |
|||
<page string="Users"> |
|||
<field name="line_ids" nolabel="1"> |
|||
<tree editable="bottom" colors="grey: not is_enabled;"> |
|||
<field name="user_id"/> |
|||
<field name="date_from"/> |
|||
<field name="date_to"/> |
|||
<field name="is_enabled"/> |
|||
</tree> |
|||
</field> |
|||
</page> |
|||
</notebook> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_res_users_role_search" model="ir.ui.view"> |
|||
<field name="name">res.users.role.search</field> |
|||
<field name="model">res.users.role</field> |
|||
<field name="arch" type="xml"> |
|||
<search string="Roles"> |
|||
<field name="name"/> |
|||
<field name="user_ids"/> |
|||
<field name="implied_ids"/> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
<record id="view_res_users_role_tree" model="ir.ui.view"> |
|||
<field name="name">res.users.role.tree</field> |
|||
<field name="model">res.users.role</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Role"> |
|||
<field name="name"/> |
|||
<field name="user_ids"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_res_users_role_search" model="ir.ui.view"> |
|||
<field name="name">res.users.role.search</field> |
|||
<field name="model">res.users.role</field> |
|||
<field name="arch" type="xml"> |
|||
<search string="Roles"> |
|||
<field name="name"/> |
|||
<field name="user_ids"/> |
|||
<field name="implied_ids"/> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.actions.act_window" id="action_res_users_role_tree"> |
|||
<field name="name">Roles</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">res.users.role</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_id" ref="view_res_users_role_tree"/> |
|||
</record> |
|||
<record model="ir.actions.act_window" id="action_res_users_role_tree"> |
|||
<field name="name">Roles</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">res.users.role</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_id" ref="view_res_users_role_tree"/> |
|||
</record> |
|||
|
|||
<menuitem id="menu_action_res_users_role_tree" |
|||
parent="base.menu_users" |
|||
action="action_res_users_role_tree"/> |
|||
<menuitem id="menu_action_res_users_role_tree" |
|||
parent="base.menu_users" |
|||
action="action_res_users_role_tree"/> |
|||
|
|||
</data> |
|||
</openerp> |
|||
</odoo> |
@ -1,39 +1,37 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2014 ABF OSIELL <http://osiell.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
<openerp> |
|||
<data> |
|||
<odoo> |
|||
|
|||
<record id="view_res_users_form_inherit" model="ir.ui.view"> |
|||
<field name="name">res.users.form.inherit</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form"/> |
|||
<field name="arch" type="xml"> |
|||
<notebook position="inside"> |
|||
<page string="Roles"> |
|||
<field name="role_line_ids" nolabel="1"> |
|||
<tree editable="bottom" colors="grey: not is_enabled;"> |
|||
<field name="role_id"/> |
|||
<field name="date_from"/> |
|||
<field name="date_to"/> |
|||
<field name="is_enabled"/> |
|||
</tree> |
|||
</field> |
|||
</page> |
|||
</notebook> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_res_users_search_inherit" model="ir.ui.view"> |
|||
<field name="name">res.users.search.inherit</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_search"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="company_ids" position="after"> |
|||
<field name="role_ids"/> |
|||
<record id="view_res_users_form_inherit" model="ir.ui.view"> |
|||
<field name="name">res.users.form.inherit</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form"/> |
|||
<field name="arch" type="xml"> |
|||
<notebook position="inside"> |
|||
<page string="Roles"> |
|||
<field name="role_line_ids" nolabel="1"> |
|||
<tree editable="bottom" colors="grey: not is_enabled;"> |
|||
<field name="role_id"/> |
|||
<field name="date_from"/> |
|||
<field name="date_to"/> |
|||
<field name="is_enabled"/> |
|||
</tree> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</page> |
|||
</notebook> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_res_users_search_inherit" model="ir.ui.view"> |
|||
<field name="name">res.users.search.inherit</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_search"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="company_ids" position="after"> |
|||
<field name="role_ids"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue