[IMP]able to pass context into record tag in xml file and pass context {"noadmin":True} in extended group data for not allocate that group to admin user
bzr revid: hmo@tinyerp.com-20091103064636-0v855wtnh06l0zop
This commit is contained in:
parent
69036a94e0
commit
5561c46196
|
@ -60,14 +60,15 @@ class groups(osv.osv):
|
|||
if vals['name'].startswith('-'):
|
||||
raise osv.except_osv(_('Error'),
|
||||
_('The name of the group can not start with "-"'))
|
||||
gid = super(groups, self).create(cr, uid, vals, context=context)
|
||||
|
||||
# assign this new group to user_root
|
||||
user_obj = self.pool.get('res.users')
|
||||
aid = user_obj.browse(cr, 1, user_obj._get_admin_id(cr))
|
||||
if aid:
|
||||
aid.write({'groups_id': [(4, gid)]})
|
||||
|
||||
gid = super(groups, self).create(cr, uid, vals, context=context)
|
||||
if context and context.get('noadmin', False):
|
||||
pass
|
||||
else:
|
||||
# assign this new group to user_root
|
||||
user_obj = self.pool.get('res.users')
|
||||
aid = user_obj.browse(cr, 1, user_obj._get_admin_id(cr))
|
||||
if aid:
|
||||
aid.write({'groups_id': [(4, gid)]})
|
||||
return gid
|
||||
|
||||
groups()
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
<field name="name">Employee</field>
|
||||
</record>
|
||||
|
||||
<record model="res.groups" id="group_extended">
|
||||
<record model="res.groups" context="{'noadmin':True}" id="group_extended">
|
||||
<field name="name">Useability / Extended View</field>
|
||||
</record>
|
||||
|
||||
<record model="res.groups" id="group_extended_menu">
|
||||
<record model="res.groups" context="{'noadmin':True}" id="group_extended_menu">
|
||||
<field name="name">Useability / Extended Menu</field>
|
||||
</record>
|
||||
|
||||
<record model="res.groups" id="group_no_one">
|
||||
<record model="res.groups" id="group_no_one" context="{'noadmin':True}">
|
||||
<field name="name">Useability / No One</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
<rng:zeroOrMore>
|
||||
<rng:ref name="field" />
|
||||
</rng:zeroOrMore>
|
||||
<rng:optional><rng:attribute name="context"/></rng:optional>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
|
|
|
@ -663,6 +663,9 @@ form: module.record_id""" % (xml_id,)
|
|||
model = self.pool.get(rec_model)
|
||||
assert model, "The model %s does not exist !" % (rec_model,)
|
||||
rec_id = rec.get("id",'').encode('ascii')
|
||||
rec_context = rec.get("context", None)
|
||||
if rec_context:
|
||||
rec_context = eval(rec_context)
|
||||
self._test_xml_id(rec_id)
|
||||
|
||||
if self.isnoupdate(data_node) and self.mode != 'init':
|
||||
|
@ -731,7 +734,7 @@ form: module.record_id""" % (xml_id,)
|
|||
f_val = int(f_val)
|
||||
res[f_name] = f_val
|
||||
|
||||
id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode )
|
||||
id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
|
||||
if rec_id:
|
||||
self.idref[rec_id] = int(id)
|
||||
if config.get('import_partial', False):
|
||||
|
|
Loading…
Reference in New Issue