X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;ds=sidebyside;f=addons%2Fprocess%2Fprocess.py;h=464cf460616a7067a270993f395f503710f3014a;hb=0d3bf8d1a21cae4d8bb70009fc34ad3520ca224c;hp=72c8bce10b4a4969bfbf404b14d2ceffe1b7aa3e;hpb=b1cf433ecc01a58c8abe27fdf9dbaba2deedf7f5;p=odoo%2Fodoo.git diff --git a/addons/process/process.py b/addons/process/process.py index 72c8bce..464cf46 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -84,12 +84,12 @@ class process_process(osv.osv): process = pool.get('process.process').browse(cr, uid, id, context=context) name = process.name - resource = None + resource = False state = 'N/A' expr_context = {} states = {} - perm = None + perm = False if res_model: states = dict(pool.get(res_model).fields_get(cr, uid, context=context).get('state', {}).get('selection', {})) @@ -131,21 +131,21 @@ class process_process(osv.osv): if node.menu_id: data['menu'] = {'name': node.menu_id.complete_name, 'id': node.menu_id.id} - if node.model_id and node.model_id.model == res_model: - try: - data['active'] = eval(node.model_states, expr_context) - except Exception: - pass - - if not data['active']: - try: - gray = True - for cond in node.condition_ids: - if cond.model_id and cond.model_id.model == res_model: - gray = gray and eval(cond.model_states, expr_context) - data['gray'] = not gray - except: - pass + try: + gray = True + for cond in node.condition_ids: + if cond.model_id and cond.model_id.model == res_model: + gray = gray and eval(cond.model_states, expr_context) + data['gray'] = not gray + except: + pass + + if not data['gray']: + if node.model_id and node.model_id.model == res_model: + try: + data['active'] = eval(node.model_states, expr_context) + except Exception: + pass nodes[node.id] = data if node.flow_start: @@ -242,7 +242,9 @@ class process_process(osv.osv): for k, v in nodes.items(): y = v['y'] v['y'] = min(y - miny + 10, y) - + + nodes = dict([str(n_key), n_val] for n_key, n_val in nodes.iteritems()) + transitions = dict([str(t_key), t_val] for t_key, t_val in transitions.iteritems()) return dict(name=name, resource=resource, state=state, perm=perm, notes=notes, nodes=nodes, transitions=transitions) def copy(self, cr, uid, id, default=None, context=None):