diff --git a/bin/addons/base/base_security.xml b/bin/addons/base/base_security.xml
index 273058b6800..54547bdb8fb 100644
--- a/bin/addons/base/base_security.xml
+++ b/bin/addons/base/base_security.xml
@@ -2,37 +2,6 @@
-
-
-
-
-
-
- ERP Manager
-
-
-
- Employee
-
-
-
- Res Config View
-
-
-
- Extended View
-
-
-
- Partner Contact
-
-
-
- Partner Manager
-
-
@@ -45,836 +14,278 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ Define password for Root user
+ ir.model.security
+ form
+
+
+
+
+
+
+ Define password for Root user
+ ir.actions.act_window
+ ir.model.security
+ form
+
+ new
+
+
+
+ Define password for Root user
+ You must define a password for the root user !
+
+ open
+
+
+
+
+ ERP Manager
+
+
+ Employee
+
+
+ Partner
+
+
+
+ Partner Manager
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ Extended View
+
-
- Ir Values
-
+
+ ir.actions.actions Employee
+
-
-
-
-
+
+
+
+
-
- Ir Values Admin
-
-
-
-
-
-
-
-
-
- View
-
+
+ ir.actions.act_window Employee
+
-
-
-
-
+
+
+
+
-
- View Admin
-
-
-
-
-
-
-
-
-
- UI Shortcut
-
+
+ ir.ui.view Employee
+
-
-
-
-
+
+
+
+
-
- UI Shortcut Admin
-
-
-
-
-
-
-
-
-
diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml
index a421f2e9d40..0f2e8ec2b08 100644
--- a/bin/addons/base/ir/ir.xml
+++ b/bin/addons/base/ir/ir.xml
@@ -620,6 +620,7 @@
+
@@ -672,6 +673,7 @@
+
diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py
index 30e106b4a5f..991550602cd 100644
--- a/bin/addons/base/ir/ir_model.py
+++ b/bin/addons/base/ir/ir_model.py
@@ -43,13 +43,13 @@ def _get_fields_type(self, cr, uid, context=None):
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.many2one('ir.model', 'Models'),
- }
-ir_model_type()
+#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'
@@ -60,8 +60,8 @@ 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.one2many('ir.model.type', 'model_id', 'Type'),
- #'type_id': fields.many2many('ir.model.type', 'ir_model_type_rel', 'model_id', 'type_id', 'Types'),
+ #'type_id': fields.many2one('ir.model.type', 'Type'),
+ 'type_id': fields.selection([('system','System'),('base','Base'),('addons','Addons')],'Type'),
'state': fields.selection([('manual','Custom Object'),('base','Base Field')],'Manualy Created',readonly=1),
}
_defaults = {
@@ -98,19 +98,21 @@ class ir_model(osv.osv):
#TODO Advanced
for model in self.browse(cr, user, ids, context):
if model.state <> 'manual':
- raise except_orm(_('Error'), _("You can not remove the model '%s' !") %(field.name,))
+ raise except_orm(_('Error'), _("You can not remove the model '%s' !") %(model.name,))
res = super(ir_model, self).unlink(cr, user, ids, context)
pooler.restart_pool(cr.dbname)
return res
def create(self, cr, user, vals, context=None):
- #TODO Advanced
- if context and context.get('manual',False):
- vals['state']='manual'
- res = super(ir_model,self).create(cr, user, vals, context)
- if vals.get('state','base')=='manual':
- pooler.restart_pool(cr.dbname)
- return res
+ if 'advanced' in context:
+ raise osv.except_osv('Error !', 'You cannot add an entry to this view !')
+ else:
+ if context.get('manual',False):
+ vals['state']='manual'
+ res = super(ir_model,self).create(cr, user, vals, context)
+ if vals.get('state','base')=='manual':
+ pooler.restart_pool(cr.dbname)
+ return res
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)
@@ -133,14 +135,14 @@ class ir_model(osv.osv):
return result
def write(self, cr, user, ids, vals, context=None):
+ vals_new = vals.copy()
if 'advanced' in context:
perms_rel = ['create','read','unlink','write']
perms_all = ['c','r','u','w']
perms = []
- vals_new = vals.copy()
for val in vals:
- if val[:6]=='group_':
+ if len(val)>5 and val[:6]=='group_':
#Values
group_id = int(val[6:])
model_id = ids[0]
@@ -152,15 +154,11 @@ class ir_model(osv.osv):
if perm not in perms_all:
model_name = self.pool.get('ir.model').browse(cr, user, [model_id])[0].model
group_name = self.pool.get('res.groups').browse(cr, user, [group_id])[0].name
- raise osv.except_osv('Error !', 'There is an invalid rule in "%s" for "Group %s". Valid rules are:\r\tc=create\r\tr=read\r\tu=unlink\r\tw=write\rYou must separate them by a coma, example: r,w'%(model_name, group_name))
+ raise osv.except_osv('Error !', _('There is an invalid rule in "%s" for "Group %s". Valid rules are:\r\tc=create\r\tr=read\r\tu=unlink\r\tw=write\rYou must separate them by a coma, example: r,w')%(model_name, group_name))
#Assign rights
req = {}
for i,perm in enumerate(perms_all):
- #if perm in perms:
- # req['perm_%s'%perms_rel[i]] = True
- #else:
- # req['perm_%s'%perms_rel[i]] = False
req['perm_%s'%perms_rel[i]] = perm in perms and 'True' or 'False'
#Apply rule
@@ -190,25 +188,15 @@ class ir_model(osv.osv):
result['group_%i'%group.id] = {'string': 'Group %s'%group.name,'type': 'char','size': 7}
return result
- def on_change_write(self, cr, user, ids, vals, context=None):
- print 'prout'
-
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False):
result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context)
if view_type=='tree' and 'advanced' in context:
groups = self.pool.get('res.groups').search(cr, uid, [])
groups_br = self.pool.get('res.groups').browse(cr, uid, groups)
- #state = ''
- #TODO: qqch du genre si un object n'a pas de secu
- #for field in journal.view_id.columns_id:
- # if field.field=='state':
- # state = ' colors="red:state==\'draft\'"'
-
cols = ['model']
xml = ''''''
for group in groups_br:
- #xml += '''''' % (group.id, group.name) #TODO: on_change
xml += '''''' % (group.id, group.name)
xml += ''''''
@@ -538,3 +526,35 @@ class ir_model_data(osv.osv):
return True
ir_model_data()
+
+
+class ir_model_security(osv.osv):
+ _name = 'ir.model.security'
+ _columns = {
+ 'password': fields.char('Password', size=64, invisible=True),
+ }
+
+ def action_cancel(self, cr, uid, ids, context={}):
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.module.module.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
+
+ 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']])
+ self.pool.get('res.users').write(cr, uid, [root.id], {'password':res['password']})
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.module.module.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
+ir_model_security()
+
diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py
index 24e16e6a03a..8cf25c21cf3 100644
--- a/bin/addons/base/res/res_user.py
+++ b/bin/addons/base/res/res_user.py
@@ -32,244 +32,251 @@ import tools
import pytz
class groups(osv.osv):
- _name = "res.groups"
- _columns = {
- 'name': fields.char('Group Name', size=64, required=True),
- 'model_access': fields.one2many('ir.model.access', 'group_id', 'Access Controls'),
- 'rule_groups': fields.many2many('ir.rule.group', 'group_rule_group_rel',
- 'group_id', 'rule_group_id', 'Rules', domain="[('global', '<>', True)]"),
- 'menu_access': fields.many2many('ir.ui.menu', 'ir_ui_menu_group_rel', 'gid', 'menu_id', 'Access Menu'),
- 'comment' : fields.text('Comment',size=250),
- }
- _sql_constraints = [
- ('name_uniq', 'unique (name)', 'The name of the group must be unique !')
- ]
+ _name = "res.groups"
+ _columns = {
+ 'name': fields.char('Group Name', size=64, required=True),
+ 'model_access': fields.one2many('ir.model.access', 'group_id', 'Access Controls'),
+ 'rule_groups': fields.many2many('ir.rule.group', 'group_rule_group_rel',
+ 'group_id', 'rule_group_id', 'Rules', domain="[('global', '<>', True)]"),
+ 'menu_access': fields.many2many('ir.ui.menu', 'ir_ui_menu_group_rel', 'gid', 'menu_id', 'Access Menu'),
+ 'comment' : fields.text('Comment',size=250),
+ }
+ _sql_constraints = [
+ ('name_uniq', 'unique (name)', 'The name of the group must be unique !')
+ ]
- def write(self, cr, uid, ids, vals, context=None):
- if 'name' in vals:
- if vals['name'].startswith('-'):
- raise osv.except_osv(_('Error'),
- _('The name of the group can not start with "-"'))
- res = super(groups, self).write(cr, uid, ids, vals, context=context)
- # Restart the cache on the company_get method
- self.pool.get('ir.rule').domain_get()
- return res
+ def write(self, cr, uid, ids, vals, context=None):
+ if 'name' in vals:
+ if vals['name'].startswith('-'):
+ raise osv.except_osv(_('Error'),
+ _('The name of the group can not start with "-"'))
+ res = super(groups, self).write(cr, uid, ids, vals, context=context)
+ # Restart the cache on the company_get method
+ self.pool.get('ir.rule').domain_get()
+ return res
- def create(self, cr, uid, vals, context=None):
- if 'name' in vals:
- if vals['name'].startswith('-'):
- raise osv.except_osv(_('Error'),
- _('The name of the group can not start with "-"'))
- return super(groups, self).create(cr, uid, vals, context=context)
+ def create(self, cr, uid, vals, context=None):
+ if 'name' in vals:
+ if vals['name'].startswith('-'):
+ raise osv.except_osv(_('Error'),
+ _('The name of the group can not start with "-"'))
+ return super(groups, self).create(cr, uid, vals, context=context)
groups()
class roles(osv.osv):
- _name = "res.roles"
- _columns = {
- 'name': fields.char('Role Name', size=64, required=True),
- 'parent_id': fields.many2one('res.roles', 'Parent', select=True),
- 'child_id': fields.one2many('res.roles', 'parent_id', 'Childs')
- }
- _defaults = {
- }
- def check(self, cr, uid, ids, role_id):
- if role_id in ids:
- return True
- cr.execute('select parent_id from res_roles where id=%d', (role_id,))
- roles = cr.fetchone()[0]
- if roles:
- return self.check(cr, uid, ids, roles)
- return False
+ _name = "res.roles"
+ _columns = {
+ 'name': fields.char('Role Name', size=64, required=True),
+ 'parent_id': fields.many2one('res.roles', 'Parent', select=True),
+ 'child_id': fields.one2many('res.roles', 'parent_id', 'Childs')
+ }
+ _defaults = {
+ }
+ def check(self, cr, uid, ids, role_id):
+ if role_id in ids:
+ return True
+ cr.execute('select parent_id from res_roles where id=%d', (role_id,))
+ roles = cr.fetchone()[0]
+ if roles:
+ return self.check(cr, uid, ids, roles)
+ return False
roles()
def _lang_get(self, cr, uid, context={}):
- obj = self.pool.get('res.lang')
- ids = obj.search(cr, uid, [])
- res = obj.read(cr, uid, ids, ['code', 'name'], context)
- res = [(r['code'], r['name']) for r in res]
- return res
+ obj = self.pool.get('res.lang')
+ ids = obj.search(cr, uid, [])
+ res = obj.read(cr, uid, ids, ['code', 'name'], context)
+ res = [(r['code'], r['name']) for r in res]
+ return res
def _tz_get(self,cr,uid, context={}):
- return [(x, x) for x in pytz.all_timezones]
+ return [(x, x) for x in pytz.all_timezones]
class users(osv.osv):
- _name = "res.users"
- _log_access = False
- _columns = {
- 'name': fields.char('Name', size=64, required=True, select=True),
- 'login': fields.char('Login', size=64, required=True),
- 'password': fields.char('Password', size=64, invisible=True),
- 'signature': fields.text('Signature', size=64),
- 'address_id': fields.many2one('res.partner.address', 'Address'),
- 'active': fields.boolean('Active'),
- 'action_id': fields.many2one('ir.actions.actions', 'Home Action'),
- 'menu_id': fields.many2one('ir.actions.actions', 'Menu Action'),
- 'groups_id': fields.many2many('res.groups', 'res_groups_users_rel', 'uid', 'gid', 'Groups'),
- 'roles_id': fields.many2many('res.roles', 'res_roles_users_rel', 'uid', 'rid', 'Roles'),
- 'company_id': fields.many2one('res.company', 'Company'),
- 'context_lang': fields.selection(_lang_get, 'Language', required=True),
- 'context_tz': fields.selection(_tz_get, 'Timezone', size=64)
- }
- def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'):
- result = super(users, self).read(cr, uid, ids, fields, context, load)
- canwrite = self.pool.get('ir.model.access').check(cr, uid, 'res.users', 'write', raise_exception=False)
- if not canwrite:
- for r in result:
- if 'password' in r:
- r['password'] = '********'
- return result
+ _name = "res.users"
+ _log_access = False
+ _columns = {
+ 'name': fields.char('Name', size=64, required=True, select=True),
+ 'login': fields.char('Login', size=64, required=True),
+ 'password': fields.char('Password', size=64, invisible=True),
+ 'signature': fields.text('Signature', size=64),
+ 'address_id': fields.many2one('res.partner.address', 'Address'),
+ 'active': fields.boolean('Active'),
+ 'action_id': fields.many2one('ir.actions.actions', 'Home Action'),
+ 'menu_id': fields.many2one('ir.actions.actions', 'Menu Action'),
+ 'groups_id': fields.many2many('res.groups', 'res_groups_users_rel', 'uid', 'gid', 'Groups'),
+ 'roles_id': fields.many2many('res.roles', 'res_roles_users_rel', 'uid', 'rid', 'Roles'),
+ 'company_id': fields.many2one('res.company', 'Company'),
+ 'context_lang': fields.selection(_lang_get, 'Language', required=True),
+ 'context_tz': fields.selection(_tz_get, 'Timezone', size=64)
+ }
+ def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'):
+ result = super(users, self).read(cr, uid, ids, fields, context, load)
+ canwrite = self.pool.get('ir.model.access').check(cr, uid, 'res.users', 'write', raise_exception=False)
+ if not canwrite:
+ for r in result:
+ if 'password' in r:
+ r['password'] = '********'
+ return result
- _sql_constraints = [
- ('login_key', 'UNIQUE (login)', 'You can not have two users with the same login !')
- ]
- def _get_action(self,cr, uid, context={}):
- ids = self.pool.get('ir.ui.menu').search(cr, uid, [('usage','=','menu')])
- return ids and ids[0] or False
+ _sql_constraints = [
+ ('login_key', 'UNIQUE (login)', 'You can not have two users with the same login !')
+ ]
+ def _get_action(self,cr, uid, context={}):
+ ids = self.pool.get('ir.ui.menu').search(cr, uid, [('usage','=','menu')])
+ return ids and ids[0] or False
- def _get_company(self,cr, uid, context={}):
- return self.pool.get('res.users').browse(cr, uid, uid, context).company_id.id
+ def _get_company(self,cr, uid, context={}):
+ return self.pool.get('res.users').browse(cr, uid, uid, context).company_id.id
- def _get_menu(self,cr, uid, context={}):
- ids = self.pool.get('ir.actions.act_window').search(cr, uid, [('usage','=','menu')])
- return ids and ids[0] or False
+ def _get_menu(self,cr, uid, context={}):
+ ids = self.pool.get('ir.actions.act_window').search(cr, uid, [('usage','=','menu')])
+ return ids and ids[0] or False
- _defaults = {
- 'password' : lambda obj,cr,uid,context={} : '',
- 'context_lang': lambda *args: 'en_US',
- 'active' : lambda obj,cr,uid,context={} : True,
- 'menu_id': _get_menu,
- 'action_id': _get_menu,
- 'company_id': _get_company,
- }
- def company_get(self, cr, uid, uid2):
- company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
- return company_id
- company_get = tools.cache()(company_get)
+ _defaults = {
+ 'password' : lambda obj,cr,uid,context={} : '',
+ 'context_lang': lambda *args: 'en_US',
+ 'active' : lambda obj,cr,uid,context={} : True,
+ 'menu_id': _get_menu,
+ 'action_id': _get_menu,
+ 'company_id': _get_company,
+ }
+ def company_get(self, cr, uid, uid2):
+ company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
+ return company_id
+ company_get = tools.cache()(company_get)
- def write(self, cr, uid, ids, values, *args, **argv):
- if (ids == [uid]):
- ok = True
- for k in values.keys():
- if k not in ('password','signature','action_id', 'context_lang', 'context_tz'):
- ok=False
- if ok:
- uid = 1
- res = super(users, self).write(cr, uid, ids, values, *args, **argv)
- self.company_get()
- # Restart the cache on the company_get method
- self.pool.get('ir.rule').domain_get()
- return res
+ def write(self, cr, uid, ids, values, *args, **argv):
+ if (ids == [uid]):
+ ok = True
+ for k in values.keys():
+ if k not in ('password','signature','action_id', 'context_lang', 'context_tz'):
+ ok=False
+ if ok:
+ uid = 1
+ res = super(users, self).write(cr, uid, ids, values, *args, **argv)
+ self.company_get()
+ # Restart the cache on the company_get method
+ self.pool.get('ir.rule').domain_get()
+ return res
- def unlink(self, cr, uid, ids):
- if 1 in ids:
- raise osv.except_osv(_('Can not remove root user!'), _('You can not remove the root user as it is used internally for resources created by Tiny ERP (updates, module installation, ...)'))
- return super(users, self).unlink(cr, uid, ids)
+ def unlink(self, cr, uid, ids):
+ if 1 in ids:
+ raise osv.except_osv(_('Can not remove root user!'), _('You can not remove the root user as it is used internally for resources created by Tiny ERP (updates, module installation, ...)'))
+ return super(users, self).unlink(cr, uid, ids)
- def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80):
- if not args:
- args=[]
- if not context:
- context={}
- ids = []
- if name:
- ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit)
- if not ids:
- ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
- return self.name_get(cr, user, ids)
+ def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80):
+ if not args:
+ args=[]
+ if not context:
+ context={}
+ ids = []
+ if name:
+ ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit)
+ if not ids:
+ ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
+ return self.name_get(cr, user, ids)
- def copy(self, cr, uid, id, default=None, context={}):
- login = self.read(cr, uid, [id], ['login'])[0]['login']
- default.update({'login': login+' (copy)'})
- return super(users, self).copy(cr, uid, id, default, context)
+ def copy(self, cr, uid, id, default=None, context={}):
+ login = self.read(cr, uid, [id], ['login'])[0]['login']
+ default.update({'login': login+' (copy)'})
+ return super(users, self).copy(cr, uid, id, default, context)
- def context_get(self, cr, uid, context={}):
- user = self.browse(cr, uid, uid, context)
- result = {}
- for k in self._columns.keys():
- if k.startswith('context_'):
- result[k[8:]] = getattr(user,k)
- return result
+ def context_get(self, cr, uid, context={}):
+ user = self.browse(cr, uid, uid, context)
+ result = {}
+ for k in self._columns.keys():
+ if k.startswith('context_'):
+ result[k[8:]] = getattr(user,k)
+ return result
- def action_get(self, cr, uid, context={}):
- dataobj = self.pool.get('ir.model.data')
- data_id = dataobj._get_id(cr, 1, 'base', 'action_res_users_my')
- return dataobj.browse(cr, uid, data_id, context).res_id
+ def action_get(self, cr, uid, context={}):
+ dataobj = self.pool.get('ir.model.data')
+ data_id = dataobj._get_id(cr, 1, 'base', 'action_res_users_my')
+ return dataobj.browse(cr, uid, data_id, context).res_id
- def action_next(self,cr,uid,ids,context=None):
- return{
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'ir.module.module.configuration.wizard',
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
+ def action_next(self,cr,uid,ids,context=None):
+ return{
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.module.module.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
- def action_continue(self,cr,uid,ids,context={}):
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'ir.module.module.configuration.wizard',
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
- def action_new(self,cr,uid,ids,context={}):
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'res.users',
- 'view_id':self.pool.get('ir.ui.view').search(cr,uid,[('name','=','res.users.confirm.form')]),
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
+ def action_continue(self,cr,uid,ids,context={}):
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.module.module.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
+ def action_new(self,cr,uid,ids,context={}):
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'res.users',
+ 'view_id':self.pool.get('ir.ui.view').search(cr,uid,[('name','=','res.users.confirm.form')]),
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
+
+ def action_cancel(self,cr,uid,ids,conect={}):
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.module.module.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
users()
class groups2(osv.osv):
- _inherit = 'res.groups'
- _columns = {
- 'users': fields.many2many('res.users', 'res_groups_users_rel', 'gid', 'uid', 'Users'),
- }
+ _inherit = 'res.groups'
+ _columns = {
+ 'users': fields.many2many('res.users', 'res_groups_users_rel', 'gid', 'uid', 'Users'),
+ }
groups2()
class res_config_view(osv.osv_memory):
- _name='res.config.view'
- _columns = {
- 'name':fields.char('Name', size=64),
- 'view': fields.selection([('simple','Simple'),('extended','Extended')], 'View', required=True ),
+ _name='res.config.view'
+ _columns = {
+ 'name':fields.char('Name', size=64),
+ 'view': fields.selection([('simple','Simple'),('extended','Extended')], 'View', required=True ),
}
- _defaults={
- 'view':lambda *args: 'simple',
- }
+ _defaults={
+ 'view':lambda *args: 'simple',
+ }
- def action_cancel(self,cr,uid,ids,conect=None):
- print ' Cancel action'
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'ir.module.module.configuration.wizard',
- 'type': 'ir.actions.act_window',
- 'target':'new',
+ def action_cancel(self,cr,uid,ids,conect=None):
+ print ' Cancel action'
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.module.module.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
}
- def action_set(self, cr, uid, ids, context=None):
- res=self.read(cr,uid,ids)[0]
- users_obj = self.pool.get('res.users')
- group_obj=self.pool.get('res.groups')
- if 'view' in res and res['view'] and res['view']=='extended':
- group_ids=group_obj.search(cr,uid,[('name','=','Extended View')])
- if group_ids and len(group_ids):
- users_obj.write(cr, uid, [3],{
- 'groups_id':[(4,group_ids[0])]
- }, context=context)
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'ir.module.module.configuration.wizard',
- 'type': 'ir.actions.act_window',
- 'target':'new',
- }
+ def action_set(self, cr, uid, ids, context=None):
+ res=self.read(cr,uid,ids)[0]
+ users_obj = self.pool.get('res.users')
+ group_obj=self.pool.get('res.groups')
+ if 'view' in res and res['view'] and res['view']=='extended':
+ group_ids=group_obj.search(cr,uid,[('name','=','Extended View')])
+ if group_ids and len(group_ids):
+ users_obj.write(cr, uid, [3],{
+ 'groups_id':[(4,group_ids[0])]
+ }, context=context)
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'ir.module.module.configuration.wizard',
+ 'type': 'ir.actions.act_window',
+ 'target':'new',
+ }
res_config_view()
-
-