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 script
This commit is contained in:
sebalix
2016-12-09 21:48:10 +01:00
committed by Duc Dao
parent 8240ef42f4
commit 604a9d1c63
5 changed files with 107 additions and 138 deletions

View File

@@ -4,7 +4,7 @@
{ {
'name': 'User roles', 'name': 'User roles',
'version': '8.0.1.1.0', 'version': '9.0.1.0.0',
'category': 'Tools', 'category': 'Tools',
'author': 'ABF OSIELL, Odoo Community Association (OCA)', 'author': 'ABF OSIELL, Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com> <!-- Copyright 2016 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp> <odoo noupdate="1">
<data noupdate="1">
<record model="ir.cron" id="cron_update_users"> <record model="ir.cron" id="cron_update_users">
<field name='name'>Update user roles</field> <field name='name'>Update user roles</field>
@@ -16,5 +15,4 @@
<field name="args">()</field> <field name="args">()</field>
</record> </record>
</data> </odoo>
</openerp>

View File

@@ -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)

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2014 ABF OSIELL <http://osiell.com> <!-- Copyright 2014 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp> <odoo>
<data>
<record id="view_res_users_role_form" model="ir.ui.view"> <record id="view_res_users_role_form" model="ir.ui.view">
<field name="name">res.users.role.form</field> <field name="name">res.users.role.form</field>
@@ -69,5 +68,4 @@
parent="base.menu_users" parent="base.menu_users"
action="action_res_users_role_tree"/> action="action_res_users_role_tree"/>
</data> </odoo>
</openerp>

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2014 ABF OSIELL <http://osiell.com> <!-- Copyright 2014 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp> <odoo>
<data>
<record id="view_res_users_form_inherit" model="ir.ui.view"> <record id="view_res_users_form_inherit" model="ir.ui.view">
<field name="name">res.users.form.inherit</field> <field name="name">res.users.form.inherit</field>
@@ -35,5 +34,4 @@
</field> </field>
</record> </record>
</data> </odoo>
</openerp>