Mohammed Shekha(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-575178-msh into 
lp:openobject-addons/6.1.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575178-msh/+merge/107764

Hello,

Fixed the issue of process view condition, here condition is not given the more 
priority then node state, if model_states are matched then process view will be 
shown in red background because if state is matched it will not go for checking 
condition.

Condition must be given more priority, if condition on node is satisfied then 
and then it should go to check for state, if condition is not going to true 
then we should not check for state.

Hence changed the code to give more priority to condition.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575178-msh/+merge/107764
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-575178-msh.
=== modified file 'process/process.py'
--- process/process.py	2011-10-16 01:28:00 +0000
+++ process/process.py	2012-05-29 12:11:19 +0000
@@ -131,21 +131,21 @@
             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:

=== modified file 'purchase/process/purchase_process.xml'
--- purchase/process/purchase_process.xml	2011-01-14 00:11:01 +0000
+++ purchase/process/purchase_process.xml	2012-05-29 12:11:19 +0000
@@ -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;object.origin==False&quot;&quot;&quot;" name="model_states"/>
             <field eval="&quot;&quot;&quot;condition_origin&quot;&quot;&quot;" name="name"/>
         </record>
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to