[MERGE] OPW 575178: process: node conditions have priority over model states (v6.0 forward-port)

- process node conditions defined which nodes can be reached in the current 
    context, so nodes which doesn't fullfill the conditions should stay gray
    even if ``model_states`` eval to True.

bzr revid: xal@openerp.com-20120716104350-0144rsnxj5h0zcs1
This commit is contained in:
Xavier ALT
2012-07-16 12:43:50 +02:00
2 changed files with 15 additions and 15 deletions
+14 -14
View File
@@ -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
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['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
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:
+1 -1
View File
@@ -135,7 +135,7 @@
<record id="process_condition_conditionorigin" model="process.condition">
<field name="model_id" ref="purchase.model_purchase_order"/>
<field name="node_id" ref="process_node_draftpurchaseorder1"/>
<field eval="&quot;&quot;&quot;object.origin==''&quot;&quot;&quot;" name="model_states"/>
<field eval="&quot;&quot;&quot;not object.origin&quot;&quot;&quot;" name="model_states"/>
<field eval="&quot;&quot;&quot;condition_origin&quot;&quot;&quot;" name="name"/>
</record>