* Added objects groups for system and base

* Renamed ir_model_security to ir_model_group

bzr revid: jean-baptiste.aubort@camptocamp.com-20080723142704-p1nlczd0vtep9qtf
This commit is contained in:
Aubort Jean-Baptiste 2008-07-23 16:27:04 +02:00
parent 986ac9207a
commit 1ed3dca300
3 changed files with 113 additions and 33 deletions

View File

@ -14,11 +14,11 @@
</record>
<!--
Redefine Root Password
Redefine Root Password Configuration Wizard
-->
<record id="view_config_root_pw" model="ir.ui.view">
<field name="name">Define password for Root user</field>
<field name="model">ir.model.security</field>
<field name="model">ir.model.config</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Define password for Root user">
@ -36,7 +36,7 @@
<record id="action_config_root_pw" model="ir.actions.act_window">
<field name="name">Define password for Root user</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.model.security</field>
<field name="res_model">ir.model.config</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_config_root_pw"/>
<field name="target">new</field>
@ -44,13 +44,13 @@
<record id="config_root_pw" model="ir.module.module.configuration.step">
<field name="name">Define password for Root user</field>
<field name="note">You must define a password for the root user !</field>
<field name="note">You must define a new password for the Root user !</field>
<field name="action_id" ref="action_config_root_pw"/>
<field name="state">open</field>
</record>
<!--
Groups
Users Groups
-->
<record model="res.groups" id="group_erp_manager">
<field name="name">ERP Manager</field>
@ -67,11 +67,99 @@
<record model="res.groups" id="group_partner_manager">
<field name="name">Partner Manager</field>
</record>
<record model="res.groups" id="group_request">
<field name="name">Request</field>
</record>
<record model="res.groups" id="group_extended">
<field name="name">Extended View</field>
</record>
<!--
Objects Groups
-->
<!--<record model="ir.model" id="base.model_ir_model">-->
<!-- <field name="model" model="ir.model" search="[('model', '=', 'ir.actions.act_window')]"/>-->
<!-- <field name="type">system</field>-->
<!--</record>-->
<!--<record model="ir.model" id="base.model_ir_actions">-->
<!-- <field name="type">system</field>-->
<!--</record>-->
<record model="ir.model" id="base.model_ir_ui_view">
<field name="type">system</field>
</record>
<record model="ir.model" id="base.model_ir_ui_view_sc">
<field name="type">system</field>
</record>
<record model="ir.model" id="base.model_ir_ui_menu">
<field name="type">system</field>
</record>
<record model="ir.model" id="base.model_res_users">
<field name="type">system</field>
</record>
<record model="ir.model" id="base.model_res_lang">
<field name="type">system</field>
</record>
<record model="ir.model" id="base.model_res_request">
<field name="type">system</field>
</record>
<record model="ir.model" id="base.model_res_partner">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_bank">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_bank_type">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_bank_type_field">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_canal">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_som">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_event">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_function">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_title">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_event_type">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner_address">
<field name="type">base</field>
</record>
<record model="ir.model" id="base.model_res_partner">
<field name="type">base</field>
</record>
<!--
Access
-->
@ -285,7 +373,15 @@
<field name="perm_unlink" eval="1"/>
</record>
<record id="access_ui_menu" model="ir.model.access">
<field name="name">Internal Request</field>
<field model="ir.model" name="model_id" ref="model_res_request"/>
<field name="group_id" ref="group_request"/>
<field eval="True" name="perm_read"/>
<field eval="True" name="perm_write"/>
<field eval="True" name="perm_create"/>
<field eval="False" name="perm_unlink"/>
</record>
</data>
</terp>

View File

@ -620,7 +620,7 @@
<page string="Object">
<field name="name" select="1"/>
<field name="model" select="1"/>
<field name="type_id" select="1"/>
<field name="type" select="1"/>
<separator colspan="4" string="Fields"/>
<field colspan="4" context="{'manual':True}" name="field_id" nolabel="1">
<tree string="Fields Description">
@ -673,7 +673,7 @@
<tree string="Model Description">
<field name="name"/>
<field name="model"/>
<field name="type_id"/>
<field name="type"/>
</tree>
</field>
</record>

View File

@ -36,21 +36,10 @@ import time
import tools
import pooler
from pprint import pprint #FIXME: Dev
def _get_fields_type(self, cr, uid, context=None):
cr.execute('select distinct ttype,ttype from ir_model_fields')
return cr.fetchall()
#class ir_model_type(osv.osv):
# _name = 'ir.model.type'
# _columns = {
# 'name': fields.char('Name', size=64, required=True),
# 'model_id': fields.one2many('ir.model', 'type_id', 'Models'),
# }
#ir_model_type()
class ir_model(osv.osv):
_name = 'ir.model'
_description = "Objects"
@ -60,8 +49,7 @@ class ir_model(osv.osv):
'model': fields.char('Object Name', size=64, required=True, search=1),
'info': fields.text('Information'),
'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True),
#'type_id': fields.many2one('ir.model.type', 'Type'),
'type_id': fields.selection([('system','System'),('base','Base'),('addons','Addons')],'Type'),
'type': fields.selection([('system','System'),('base','Base'),('addons','Addons')],'Type'),
'state': fields.selection([('manual','Custom Object'),('base','Base Field')],'Manualy Created',readonly=1),
}
_defaults = {
@ -104,7 +92,7 @@ class ir_model(osv.osv):
return res
def create(self, cr, user, vals, context=None):
if 'advanced' in context:
if context and 'advanced' in context:
raise osv.except_osv('Error !', 'You cannot add an entry to this view !')
else:
if context.get('manual',False):
@ -116,7 +104,7 @@ class ir_model(osv.osv):
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
result = super(osv.osv, self).read(cr, user, ids, fields, context, load)
if 'advanced' in context:
if context and 'advanced' in context:
for res in result:
rules = self.pool.get('ir.model.access').search(cr, user, [('model_id', '=', res['id'])])
rules_br = self.pool.get('ir.model.access').browse(cr, user, rules)
@ -136,7 +124,7 @@ class ir_model(osv.osv):
def write(self, cr, user, ids, vals, context=None):
vals_new = vals.copy()
if 'advanced' in context:
if context and 'advanced' in context:
perms_rel = ['create','read','unlink','write']
perms_all = ['c','r','u','w']
perms = []
@ -194,8 +182,8 @@ class ir_model(osv.osv):
groups = self.pool.get('res.groups').search(cr, uid, [])
groups_br = self.pool.get('res.groups').browse(cr, uid, groups)
cols = ['model']
xml = '''<?xml version="1.0"?><tree editable="top"><field name="model" readonly="1"/>'''
cols = ['model', 'type']
xml = '''<?xml version="1.0"?><tree editable="top"><field name="model" readonly="1"/><field name="type" readonly="1"/>'''
for group in groups_br:
xml += '''<field name="group_%i" sum="%s"/>''' % (group.id, group.name)
xml += '''</tree>'''
@ -526,10 +514,8 @@ class ir_model_data(osv.osv):
return True
ir_model_data()
class ir_model_security(osv.osv):
_name = 'ir.model.security'
class ir_model_config(osv.osv):
_name = 'ir.model.config'
_columns = {
'password': fields.char('Password', size=64, invisible=True),
}
@ -544,7 +530,6 @@ class ir_model_security(osv.osv):
}
def action_update_pw(self, cr, uid, ids, context={}):
from pprint import pprint
res = self.read(cr,uid,ids)[0]
root = self.pool.get('res.users').browse(cr, uid, [1])[0]
self.unlink(cr, uid, [res['id']])
@ -556,5 +541,4 @@ class ir_model_security(osv.osv):
'type': 'ir.actions.act_window',
'target':'new',
}
ir_model_security()
ir_model_config()