Added Groups option for report,wizard and act_window.
bzr revid: jvo@tinyerp.com-20080918140205-dod9qocp1n1u9q0b
This commit is contained in:
parent
deec1863f6
commit
34fcda731a
|
@ -148,6 +148,26 @@ class act_window(osv.osv):
|
||||||
_table = 'ir_act_window'
|
_table = 'ir_act_window'
|
||||||
_sequence = 'ir_actions_id_seq'
|
_sequence = 'ir_actions_id_seq'
|
||||||
|
|
||||||
|
# def search(self, cr, uid, args, offset=0, limit=2000, order=None,
|
||||||
|
# context=None, count=False):
|
||||||
|
# if context is None:
|
||||||
|
# context = {}
|
||||||
|
# ids = osv.orm.orm.search(self, cr, uid, args, offset, limit, order,
|
||||||
|
# context=context)
|
||||||
|
# if uid==1:
|
||||||
|
# return ids
|
||||||
|
# user_groups = self.pool.get('res.users').read(cr, uid, [uid])[0]['groups_id']
|
||||||
|
# result = []
|
||||||
|
# for act in self.browse(cr, uid, ids):
|
||||||
|
# if not len(act.groups_id):
|
||||||
|
# result.append(act.id)
|
||||||
|
# continue
|
||||||
|
# for g in act.groups_id:
|
||||||
|
# if g.id in user_groups:
|
||||||
|
# result.append(act.id)
|
||||||
|
# break
|
||||||
|
# return result
|
||||||
|
|
||||||
def _views_get_fnc(self, cr, uid, ids, name, arg, context={}):
|
def _views_get_fnc(self, cr, uid, ids, name, arg, context={}):
|
||||||
res={}
|
res={}
|
||||||
for act in self.browse(cr, uid, ids):
|
for act in self.browse(cr, uid, ids):
|
||||||
|
@ -186,6 +206,8 @@ class act_window(osv.osv):
|
||||||
'limit': fields.integer('Limit', help='Default limit for the list view'),
|
'limit': fields.integer('Limit', help='Default limit for the list view'),
|
||||||
'auto_refresh': fields.integer('Auto-Refresh',
|
'auto_refresh': fields.integer('Auto-Refresh',
|
||||||
help='Add an auto-refresh on the view'),
|
help='Add an auto-refresh on the view'),
|
||||||
|
'groups_id': fields.many2many('res.groups', 'ir_act_window_group_rel',
|
||||||
|
'act_id', 'gid', 'Groups'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'type': lambda *a: 'ir.actions.act_window',
|
'type': lambda *a: 'ir.actions.act_window',
|
||||||
|
@ -261,7 +283,7 @@ def model_get(self, cr, uid, context={}):
|
||||||
wkf_pool = self.pool.get('workflow')
|
wkf_pool = self.pool.get('workflow')
|
||||||
ids = wkf_pool.search(cr, uid, [])
|
ids = wkf_pool.search(cr, uid, [])
|
||||||
osvs = wkf_pool.read(cr, uid, ids, ['osv'])
|
osvs = wkf_pool.read(cr, uid, ids, ['osv'])
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
mpool = self.pool.get('ir.model')
|
mpool = self.pool.get('ir.model')
|
||||||
for osv in osvs:
|
for osv in osvs:
|
||||||
|
@ -269,7 +291,7 @@ def model_get(self, cr, uid, context={}):
|
||||||
id = mpool.search(cr, uid, [('model','=',model)])
|
id = mpool.search(cr, uid, [('model','=',model)])
|
||||||
name = mpool.read(cr, uid, id)[0]['name']
|
name = mpool.read(cr, uid, id)[0]['name']
|
||||||
res.append((model, name))
|
res.append((model, name))
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class ir_model_fields(osv.osv):
|
class ir_model_fields(osv.osv):
|
||||||
|
@ -285,26 +307,26 @@ class ir_model_fields(osv.osv):
|
||||||
result = []
|
result = []
|
||||||
mobj = self.pool.get('ir.model')
|
mobj = self.pool.get('ir.model')
|
||||||
id = mobj.search(cr, uid, [('model','=',rel)])
|
id = mobj.search(cr, uid, [('model','=',rel)])
|
||||||
|
|
||||||
obj = self.pool.get('ir.model.fields')
|
obj = self.pool.get('ir.model.fields')
|
||||||
ids = obj.search(cr, uid, [('model_id','in',id)])
|
ids = obj.search(cr, uid, [('model_id','in',id)])
|
||||||
records = obj.read(cr, uid, ids)
|
records = obj.read(cr, uid, ids)
|
||||||
for record in records:
|
for record in records:
|
||||||
id = record['id']
|
id = record['id']
|
||||||
fld = field + '/' + record['name']
|
fld = field + '/' + record['name']
|
||||||
|
|
||||||
result.append((id, fld))
|
result.append((id, fld))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
args=[]
|
args=[]
|
||||||
if not context:
|
if not context:
|
||||||
context={}
|
context={}
|
||||||
return super(ir_model_fields, self).name_search(cr, uid, name, args, operator, context, limit)
|
return super(ir_model_fields, self).name_search(cr, uid, name, args, operator, context, limit)
|
||||||
|
|
||||||
if context.get('key') != 'server_action':
|
if context.get('key') != 'server_action':
|
||||||
return super(ir_model_fields, self).name_search(cr, uid, name, args, operator, context, limit)
|
return super(ir_model_fields, self).name_search(cr, uid, name, args, operator, context, limit)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
obj = self.pool.get('ir.model.fields')
|
obj = self.pool.get('ir.model.fields')
|
||||||
ids = obj.search(cr, uid, args)
|
ids = obj.search(cr, uid, args)
|
||||||
|
@ -312,7 +334,7 @@ class ir_model_fields(osv.osv):
|
||||||
for record in records:
|
for record in records:
|
||||||
id = record['id']
|
id = record['id']
|
||||||
field = record['name']
|
field = record['name']
|
||||||
|
|
||||||
if record['ttype'] == 'many2one':
|
if record['ttype'] == 'many2one':
|
||||||
rel = record['relation']
|
rel = record['relation']
|
||||||
res = get_fields(cr, uid, field, record['relation'])
|
res = get_fields(cr, uid, field, record['relation'])
|
||||||
|
@ -320,16 +342,16 @@ class ir_model_fields(osv.osv):
|
||||||
result.append(rs)
|
result.append(rs)
|
||||||
|
|
||||||
result.append((id, field))
|
result.append((id, field))
|
||||||
|
|
||||||
for rs in result:
|
for rs in result:
|
||||||
obj.write(cr, uid, [rs[0]], {'complete_name':rs[1]})
|
obj.write(cr, uid, [rs[0]], {'complete_name':rs[1]})
|
||||||
|
|
||||||
iids = []
|
iids = []
|
||||||
for rs in result:
|
for rs in result:
|
||||||
iids.append(rs[0])
|
iids.append(rs[0])
|
||||||
|
|
||||||
result = super(ir_model_fields, self).name_search(cr, uid, name, [('complete_name','ilike',name), ('id','in',iids)], operator, context, limit)
|
result = super(ir_model_fields, self).name_search(cr, uid, name, [('complete_name','ilike',name), ('id','in',iids)], operator, context, limit)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
ir_model_fields()
|
ir_model_fields()
|
||||||
|
@ -404,35 +426,35 @@ class actions_server(osv.osv):
|
||||||
""",
|
""",
|
||||||
'otype': lambda *a: 'copy',
|
'otype': lambda *a: 'copy',
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_field_value(self, cr, uid, action, context):
|
def get_field_value(self, cr, uid, action, context):
|
||||||
obj_pool = self.pool.get(action.model_id.model)
|
obj_pool = self.pool.get(action.model_id.model)
|
||||||
id = context.get('active_id')
|
id = context.get('active_id')
|
||||||
obj = obj_pool.browse(cr, uid, id)
|
obj = obj_pool.browse(cr, uid, id)
|
||||||
|
|
||||||
fields = None
|
fields = None
|
||||||
|
|
||||||
if '/' in action.address.complete_name:
|
if '/' in action.address.complete_name:
|
||||||
fields = action.address.complete_name.split('/')
|
fields = action.address.complete_name.split('/')
|
||||||
elif '.' in action.address.complete_name:
|
elif '.' in action.address.complete_name:
|
||||||
fields = action.address.complete_name.split('.')
|
fields = action.address.complete_name.split('.')
|
||||||
|
|
||||||
for field in fields:
|
for field in fields:
|
||||||
try:
|
try:
|
||||||
obj = getattr(obj, field)
|
obj = getattr(obj, field)
|
||||||
except Exception,e :
|
except Exception,e :
|
||||||
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
|
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
def merge_message(self, cr, uid, keystr, action, context):
|
def merge_message(self, cr, uid, keystr, action, context):
|
||||||
logger = netsvc.Logger()
|
logger = netsvc.Logger()
|
||||||
def merge(match):
|
def merge(match):
|
||||||
|
|
||||||
obj_pool = self.pool.get(action.model_id.model)
|
obj_pool = self.pool.get(action.model_id.model)
|
||||||
id = context.get('active_id')
|
id = context.get('active_id')
|
||||||
obj = obj_pool.browse(cr, uid, id)
|
obj = obj_pool.browse(cr, uid, id)
|
||||||
|
|
||||||
field = match.group()
|
field = match.group()
|
||||||
field = field.replace('[','')
|
field = field.replace('[','')
|
||||||
field = field.replace(']','')
|
field = field.replace(']','')
|
||||||
|
@ -444,13 +466,13 @@ class actions_server(osv.osv):
|
||||||
obj = getattr(obj, field)
|
obj = getattr(obj, field)
|
||||||
except Exception,e :
|
except Exception,e :
|
||||||
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
|
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
|
||||||
|
|
||||||
return str(obj)
|
return str(obj)
|
||||||
|
|
||||||
com = re.compile('\[\[(.+?)\]\]')
|
com = re.compile('\[\[(.+?)\]\]')
|
||||||
message = com.sub(merge, keystr)
|
message = com.sub(merge, keystr)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
#
|
#
|
||||||
# Context should contains:
|
# Context should contains:
|
||||||
# ids : original ids
|
# ids : original ids
|
||||||
|
@ -473,14 +495,14 @@ class actions_server(osv.osv):
|
||||||
exec action.code in localdict
|
exec action.code in localdict
|
||||||
if 'action' in localdict:
|
if 'action' in localdict:
|
||||||
return localdict['action']
|
return localdict['action']
|
||||||
|
|
||||||
if action.state == 'email':
|
if action.state == 'email':
|
||||||
user = config['email_from']
|
user = config['email_from']
|
||||||
subject = action.name
|
subject = action.name
|
||||||
|
|
||||||
address = self.get_field_value(cr, uid, str(action.message), action, context)
|
address = self.get_field_value(cr, uid, str(action.message), action, context)
|
||||||
body = self.merge_message(cr, uid, action, context)
|
body = self.merge_message(cr, uid, action, context)
|
||||||
|
|
||||||
if tools.email_send_attach(user, address, subject, body, debug=False) == True:
|
if tools.email_send_attach(user, address, subject, body, debug=False) == True:
|
||||||
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (address))
|
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (address))
|
||||||
else:
|
else:
|
||||||
|
@ -492,7 +514,7 @@ class actions_server(osv.osv):
|
||||||
model = res[0]
|
model = res[0]
|
||||||
id = res[1]
|
id = res[1]
|
||||||
wf_service.trg_validate(uid, model, int(id), action.trigger_name, cr)
|
wf_service.trg_validate(uid, model, int(id), action.trigger_name, cr)
|
||||||
|
|
||||||
if action.state == 'sms':
|
if action.state == 'sms':
|
||||||
#TODO: set the user and password from the system
|
#TODO: set the user and password from the system
|
||||||
# for the sms gateway user / password
|
# for the sms gateway user / password
|
||||||
|
@ -513,7 +535,7 @@ class actions_server(osv.osv):
|
||||||
'cr': cr,
|
'cr': cr,
|
||||||
'uid': uid
|
'uid': uid
|
||||||
}
|
}
|
||||||
|
|
||||||
for act in action.child_ids:
|
for act in action.child_ids:
|
||||||
code = """action = {'model':'%s','type':'%s', %s}""" % (action.model_id.model, act.type, act.usage)
|
code = """action = {'model':'%s','type':'%s', %s}""" % (action.model_id.model, act.type, act.usage)
|
||||||
exec code in localdict
|
exec code in localdict
|
||||||
|
@ -531,7 +553,7 @@ class actions_server(osv.osv):
|
||||||
res[exp.col1.name] = expr
|
res[exp.col1.name] = expr
|
||||||
obj_pool = self.pool.get(action.model_id.model)
|
obj_pool = self.pool.get(action.model_id.model)
|
||||||
obj_pool.write(cr, uid, [context.get('active_id')], res)
|
obj_pool.write(cr, uid, [context.get('active_id')], res)
|
||||||
|
|
||||||
if action.state == 'object_create':
|
if action.state == 'object_create':
|
||||||
res = {}
|
res = {}
|
||||||
for exp in action.fields_lines:
|
for exp in action.fields_lines:
|
||||||
|
@ -542,7 +564,7 @@ class actions_server(osv.osv):
|
||||||
else:
|
else:
|
||||||
expr = exp.value
|
expr = exp.value
|
||||||
res[exp.col1.name] = expr
|
res[exp.col1.name] = expr
|
||||||
|
|
||||||
obj_pool = None
|
obj_pool = None
|
||||||
if action.state == 'object_create' and action.otype == 'new':
|
if action.state == 'object_create' and action.otype == 'new':
|
||||||
obj_pool = self.pool.get(action.srcmodel_id.model)
|
obj_pool = self.pool.get(action.srcmodel_id.model)
|
||||||
|
@ -551,7 +573,7 @@ class actions_server(osv.osv):
|
||||||
obj_pool = self.pool.get(action.model_id.model)
|
obj_pool = self.pool.get(action.model_id.model)
|
||||||
id = context.get('active_id')
|
id = context.get('active_id')
|
||||||
obj_pool.copy(cr, uid, id, res)
|
obj_pool.copy(cr, uid, id, res)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
actions_server()
|
actions_server()
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ class ir_ui_menu(osv.osv):
|
||||||
'key2': 'tree_but_open',
|
'key2': 'tree_but_open',
|
||||||
'res_id': menu_id,
|
'res_id': menu_id,
|
||||||
}, context=ctx)
|
}, context=ctx)
|
||||||
|
|
||||||
def _get_icon_pict(self, cr, uid, ids, name, args, context):
|
def _get_icon_pict(self, cr, uid, ids, name, args, context):
|
||||||
res = {}
|
res = {}
|
||||||
for m in self.browse(cr, uid, ids, context=context):
|
for m in self.browse(cr, uid, ids, context=context):
|
||||||
|
|
|
@ -144,7 +144,7 @@ class ir_values(osv.osv):
|
||||||
m,res_id = m
|
m,res_id = m
|
||||||
else:
|
else:
|
||||||
res_id=False
|
res_id=False
|
||||||
|
|
||||||
where1 = ['key=%s','model=%s']
|
where1 = ['key=%s','model=%s']
|
||||||
where2 = [key,str(m)]
|
where2 = [key,str(m)]
|
||||||
where_opt = []
|
where_opt = []
|
||||||
|
@ -172,7 +172,6 @@ class ir_values(osv.osv):
|
||||||
# if not without_user:
|
# if not without_user:
|
||||||
where_opt.append('user_id=%d' % (uid,))
|
where_opt.append('user_id=%d' % (uid,))
|
||||||
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
ok = True
|
ok = True
|
||||||
while ok:
|
while ok:
|
||||||
|
@ -200,7 +199,7 @@ class ir_values(osv.osv):
|
||||||
'and (company_id is null or company_id = %d) '\
|
'and (company_id is null or company_id = %d) '\
|
||||||
'ORDER BY user_id', (cid,))
|
'ORDER BY user_id', (cid,))
|
||||||
result = cr.fetchall()
|
result = cr.fetchall()
|
||||||
|
|
||||||
def _result_get(x, keys):
|
def _result_get(x, keys):
|
||||||
if x[1] in keys:
|
if x[1] in keys:
|
||||||
return False
|
return False
|
||||||
|
@ -233,20 +232,20 @@ class ir_values(osv.osv):
|
||||||
res = filter(bool, map(lambda x: _result_get(x, keys), list(result)))
|
res = filter(bool, map(lambda x: _result_get(x, keys), list(result)))
|
||||||
res2 = res[:]
|
res2 = res[:]
|
||||||
for r in res:
|
for r in res:
|
||||||
if type(r) == type([]):
|
if r[2]['type'] in ('ir.actions.report.xml','ir.actions.act_window','ir.actions.wizard'):
|
||||||
if r[2]['type'] == 'ir.actions.report.xml' or r[2]['type'] == 'ir.actions.report.xml':
|
if r[2].has_key('groups_id'):
|
||||||
print
|
groups = r[2]['groups_id']
|
||||||
if r[2].has_key('groups_id'):
|
if len(groups) > 0:
|
||||||
groups = r[2]['groups_id']
|
group_ids = ','.join([ str(x) for x in r[2]['groups_id']])
|
||||||
if len(groups) > 0:
|
cr.execute("select count(*) from res_groups_users_rel where gid in (%s) and uid='%s'" % (group_ids, uid))
|
||||||
group_ids = ','.join([ str(x) for x in r[2]['groups_id']])
|
gr_ids = cr.fetchall()
|
||||||
cr.execute("select count(*) from res_groups_users_rel where gid in (%s) and uid='%s'" % (group_ids, uid))
|
if not gr_ids[0][0] > 0:
|
||||||
gr_ids = cr.fetchall()
|
res2.remove(r)
|
||||||
if not gr_ids[0][0] > 0:
|
if r[1]=='Menuitem' and not res2:
|
||||||
res2.remove(r)
|
raise osv.except_osv('Error !','You do not have the permission to perform this operation !!!')
|
||||||
else:
|
# else:
|
||||||
#raise osv.except_osv('Error !','You have not permission to perform operation !!!')
|
# #raise osv.except_osv('Error !','You have not permission to perform operation !!!')
|
||||||
res2.remove(r)
|
# res2.remove(r)
|
||||||
return res2
|
return res2
|
||||||
ir_values()
|
ir_values()
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
<rng:optional><rng:attribute name="keyword" /></rng:optional>
|
<rng:optional><rng:attribute name="keyword" /></rng:optional>
|
||||||
<rng:optional><rng:attribute name="multi" /></rng:optional>
|
<rng:optional><rng:attribute name="multi" /></rng:optional>
|
||||||
<rng:optional><rng:attribute name="client_action_multi" /></rng:optional>
|
<rng:optional><rng:attribute name="client_action_multi" /></rng:optional>
|
||||||
|
<rng:optional> <rng:attribute name="groups"/> </rng:optional>
|
||||||
</rng:element>
|
</rng:element>
|
||||||
</rng:define>
|
</rng:define>
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@
|
||||||
<rng:optional> <rng:attribute name="auto" /> </rng:optional>
|
<rng:optional> <rng:attribute name="auto" /> </rng:optional>
|
||||||
<rng:optional> <rng:attribute name="header" /> </rng:optional>
|
<rng:optional> <rng:attribute name="header" /> </rng:optional>
|
||||||
<rng:optional> <rng:attribute name="attachment" /> </rng:optional>
|
<rng:optional> <rng:attribute name="attachment" /> </rng:optional>
|
||||||
|
<rng:optional> <rng:attribute name="groups"/> </rng:optional>
|
||||||
<rng:empty />
|
<rng:empty />
|
||||||
</rng:element>
|
</rng:element>
|
||||||
</rng:define>
|
</rng:define>
|
||||||
|
@ -178,6 +180,7 @@
|
||||||
<rng:optional> <rng:attribute name="view_mode"/> </rng:optional>
|
<rng:optional> <rng:attribute name="view_mode"/> </rng:optional>
|
||||||
<rng:optional> <rng:attribute name="multi"/> </rng:optional>
|
<rng:optional> <rng:attribute name="multi"/> </rng:optional>
|
||||||
<rng:optional> <rng:attribute name="target"/> </rng:optional>
|
<rng:optional> <rng:attribute name="target"/> </rng:optional>
|
||||||
|
<rng:optional> <rng:attribute name="groups"/> </rng:optional>
|
||||||
<rng:empty />
|
<rng:empty />
|
||||||
</rng:element>
|
</rng:element>
|
||||||
</rng:define>
|
</rng:define>
|
||||||
|
|
|
@ -160,7 +160,7 @@ def init_logger():
|
||||||
logf = config['logfile']
|
logf = config['logfile']
|
||||||
# test if the directories exist, else create them
|
# test if the directories exist, else create them
|
||||||
try:
|
try:
|
||||||
handler = logging.handlers.TimedRotatingFileHandler(logf,'D',1,30)
|
handler = logging.handlers.TimedRotatingFileHandler(logf,'D',1,30)
|
||||||
except:
|
except:
|
||||||
sys.stderr.write("ERROR: couldn't create the logfile directory\n")
|
sys.stderr.write("ERROR: couldn't create the logfile directory\n")
|
||||||
handler = logging.StreamHandler(sys.stdout)
|
handler = logging.StreamHandler(sys.stdout)
|
||||||
|
@ -185,7 +185,7 @@ def init_logger():
|
||||||
colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', None, 'default']
|
colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', None, 'default']
|
||||||
foreground = lambda f: 30 + colors.index(f)
|
foreground = lambda f: 30 + colors.index(f)
|
||||||
background = lambda f: 40 + colors.index(f)
|
background = lambda f: 40 + colors.index(f)
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
'DEBUG': ('blue', 'default'),
|
'DEBUG': ('blue', 'default'),
|
||||||
'INFO': ('green', 'default'),
|
'INFO': ('green', 'default'),
|
||||||
|
|
|
@ -230,7 +230,7 @@ class xml_import(object):
|
||||||
assert '.' not in id, """The ID reference "%s" must contains
|
assert '.' not in id, """The ID reference "%s" must contains
|
||||||
maximum one dot. They are used to refer to other modules ID, in the
|
maximum one dot. They are used to refer to other modules ID, in the
|
||||||
form: module.record_id""" % (xml_id,)
|
form: module.record_id""" % (xml_id,)
|
||||||
if module != self.module:
|
if module != self.module:
|
||||||
modcnt = self.pool.get('ir.module.module').search_count(self.cr, self.uid, ['&', ('name', '=', module), ('state', 'in', ['installed'])])
|
modcnt = self.pool.get('ir.module.module').search_count(self.cr, self.uid, ['&', ('name', '=', module), ('state', 'in', ['installed'])])
|
||||||
assert modcnt == 1, """The ID "%s" refer to an uninstalled module""" % (xml_id,)
|
assert modcnt == 1, """The ID "%s" refer to an uninstalled module""" % (xml_id,)
|
||||||
|
|
||||||
|
@ -269,6 +269,20 @@ form: module.record_id""" % (xml_id,)
|
||||||
res['multi'] = rec.hasAttribute('multi') and eval(rec.getAttribute('multi'))
|
res['multi'] = rec.hasAttribute('multi') and eval(rec.getAttribute('multi'))
|
||||||
xml_id = rec.getAttribute('id').encode('utf8')
|
xml_id = rec.getAttribute('id').encode('utf8')
|
||||||
self._test_xml_id(xml_id)
|
self._test_xml_id(xml_id)
|
||||||
|
|
||||||
|
if rec.hasAttribute('groups'):
|
||||||
|
g_names = rec.getAttribute('groups').split(',')
|
||||||
|
groups_value = []
|
||||||
|
groups_obj = self.pool.get('res.groups')
|
||||||
|
for group in g_names:
|
||||||
|
if group.startswith('-'):
|
||||||
|
group_id = self.id_get(cr, 'res.groups', group[1:])
|
||||||
|
groups_value.append((3, group_id))
|
||||||
|
else:
|
||||||
|
group_id = self.id_get(cr, 'res.groups', group)
|
||||||
|
groups_value.append((4, group_id))
|
||||||
|
res['groups_id'] = groups_value
|
||||||
|
|
||||||
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.report.xml", self.module, res, xml_id, mode=self.mode)
|
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.report.xml", self.module, res, xml_id, mode=self.mode)
|
||||||
self.idref[xml_id] = int(id)
|
self.idref[xml_id] = int(id)
|
||||||
if not rec.hasAttribute('menu') or eval(rec.getAttribute('menu')):
|
if not rec.hasAttribute('menu') or eval(rec.getAttribute('menu')):
|
||||||
|
@ -296,6 +310,19 @@ form: module.record_id""" % (xml_id,)
|
||||||
multi = rec.hasAttribute('multi') and eval(rec.getAttribute('multi'))
|
multi = rec.hasAttribute('multi') and eval(rec.getAttribute('multi'))
|
||||||
res = {'name': string, 'wiz_name': name, 'multi':multi}
|
res = {'name': string, 'wiz_name': name, 'multi':multi}
|
||||||
|
|
||||||
|
if rec.hasAttribute('groups'):
|
||||||
|
g_names = rec.getAttribute('groups').split(',')
|
||||||
|
groups_value = []
|
||||||
|
groups_obj = self.pool.get('res.groups')
|
||||||
|
for group in g_names:
|
||||||
|
if group.startswith('-'):
|
||||||
|
group_id = self.id_get(cr, 'res.groups', group[1:])
|
||||||
|
groups_value.append((3, group_id))
|
||||||
|
else:
|
||||||
|
group_id = self.id_get(cr, 'res.groups', group)
|
||||||
|
groups_value.append((4, group_id))
|
||||||
|
res['groups_id'] = groups_value
|
||||||
|
|
||||||
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.wizard", self.module, res, xml_id, mode=self.mode)
|
id = self.pool.get('ir.model.data')._update(cr, self.uid, "ir.actions.wizard", self.module, res, xml_id, mode=self.mode)
|
||||||
self.idref[xml_id] = int(id)
|
self.idref[xml_id] = int(id)
|
||||||
# ir_set
|
# ir_set
|
||||||
|
@ -347,6 +374,7 @@ form: module.record_id""" % (xml_id,)
|
||||||
limit = rec.hasAttribute('limit') and rec.getAttribute('limit').encode('utf-8')
|
limit = rec.hasAttribute('limit') and rec.getAttribute('limit').encode('utf-8')
|
||||||
auto_refresh = rec.hasAttribute('auto_refresh') \
|
auto_refresh = rec.hasAttribute('auto_refresh') \
|
||||||
and rec.getAttribute('auto_refresh').encode('utf-8')
|
and rec.getAttribute('auto_refresh').encode('utf-8')
|
||||||
|
# groups_id = rec.hasAttribute('groups') and rec.getAttribute('groups').encode('utf-8')
|
||||||
|
|
||||||
res = {
|
res = {
|
||||||
'name': name,
|
'name': name,
|
||||||
|
@ -361,7 +389,22 @@ form: module.record_id""" % (xml_id,)
|
||||||
'usage': usage,
|
'usage': usage,
|
||||||
'limit': limit,
|
'limit': limit,
|
||||||
'auto_refresh': auto_refresh,
|
'auto_refresh': auto_refresh,
|
||||||
|
# 'groups_id':groups_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rec.hasAttribute('groups'):
|
||||||
|
g_names = rec.getAttribute('groups').split(',')
|
||||||
|
groups_value = []
|
||||||
|
groups_obj = self.pool.get('res.groups')
|
||||||
|
for group in g_names:
|
||||||
|
if group.startswith('-'):
|
||||||
|
group_id = self.id_get(cr, 'res.groups', group[1:])
|
||||||
|
groups_value.append((3, group_id))
|
||||||
|
else:
|
||||||
|
group_id = self.id_get(cr, 'res.groups', group)
|
||||||
|
groups_value.append((4, group_id))
|
||||||
|
res['groups_id'] = groups_value
|
||||||
|
|
||||||
if rec.hasAttribute('target'):
|
if rec.hasAttribute('target'):
|
||||||
res['target'] = rec.getAttribute('target')
|
res['target'] = rec.getAttribute('target')
|
||||||
id = self.pool.get('ir.model.data')._update(cr, self.uid, 'ir.actions.act_window', self.module, res, xml_id, mode=self.mode)
|
id = self.pool.get('ir.model.data')._update(cr, self.uid, 'ir.actions.act_window', self.module, res, xml_id, mode=self.mode)
|
||||||
|
@ -493,6 +536,7 @@ form: module.record_id""" % (xml_id,)
|
||||||
values['sequence'] = int(rec.getAttribute('sequence'))
|
values['sequence'] = int(rec.getAttribute('sequence'))
|
||||||
if rec.hasAttribute('icon'):
|
if rec.hasAttribute('icon'):
|
||||||
values['icon'] = str(rec.getAttribute('icon'))
|
values['icon'] = str(rec.getAttribute('icon'))
|
||||||
|
|
||||||
if rec.hasAttribute('groups'):
|
if rec.hasAttribute('groups'):
|
||||||
g_names = rec.getAttribute('groups').split(',')
|
g_names = rec.getAttribute('groups').split(',')
|
||||||
groups_value = []
|
groups_value = []
|
||||||
|
|
Loading…
Reference in New Issue