Commit f4291c41 authored by Romain Courteaud's avatar Romain Courteaud

Production builders must only select Simulation Movement.

Thanks to Lukasz Nowak.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15236 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a88a498
...@@ -68,11 +68,7 @@ ...@@ -68,11 +68,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># XXX need to implement this part in the catalog\n <value> <string>def test(movement):\n
# portal type causality of root applied rule\n
# XXX kw[\'orderType\'] = \'Sale Order\'\n
\n
def test(movement):\n
root_applied_rule = movement.getRootAppliedRule()\n root_applied_rule = movement.getRootAppliedRule()\n
root_rule = root_applied_rule.getSpecialiseValue()\n root_rule = root_applied_rule.getSpecialiseValue()\n
root_movement = movement.getRootSimulationMovement()\n root_movement = movement.getRootSimulationMovement()\n
...@@ -83,15 +79,20 @@ def test(movement):\n ...@@ -83,15 +79,20 @@ def test(movement):\n
parent_rule.getPortalType() == "Transformation Rule" and\\\n parent_rule.getPortalType() == "Transformation Rule" and\\\n
root_movement.getSimulationState() == "confirmed"\n root_movement.getSimulationState() == "confirmed"\n
)\n )\n
search_kw = {\n
\'resource_portal_type\': \'Simulation Movement\',\n
}\n
\n \n
kw.update(context.portal_catalog.buildSQLQuery(**kw))\n if explanation_uid is not None:\n
search_kw[\'explanation_uid\'] = explanation_uid\n
search_kw.update(context.portal_catalog.buildSQLQuery(**search_kw))\n
\n \n
if src__==0:\n if src__==0:\n
movement_list = [x.getObject() for x in context.ProductionOrder_zSelectMovement(**kw)]\n movement_list = [x.getObject() for x in context.ProductionOrder_zSelectMovement(**search_kw)]\n
movement_list = [x for x in movement_list if test(x)]\n movement_list = [x for x in movement_list if test(x)]\n
return movement_list\n return movement_list\n
else:\n else:\n
return context.ProductionOrder_zSelectMovement(src__=1, **kw)\n return context.ProductionOrder_zSelectMovement(src__=1, **search_kw)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -108,7 +109,7 @@ else:\n ...@@ -108,7 +109,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>src__=0, **kw</string> </value> <value> <string>explanation_uid=None, src__=0, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -128,15 +129,19 @@ else:\n ...@@ -128,15 +129,19 @@ else:\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>explanation_uid</string>
<string>src__</string> <string>src__</string>
<string>kw</string> <string>kw</string>
<string>test</string> <string>test</string>
<string>search_kw</string>
<string>None</string>
<string>_write_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>_apply_</string> <string>_apply_</string>
<string>context</string> <string>context</string>
...@@ -157,6 +162,7 @@ else:\n ...@@ -157,6 +162,7 @@ else:\n
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple> <tuple>
<none/>
<int>0</int> <int>0</int>
</tuple> </tuple>
</value> </value>
......
...@@ -68,11 +68,7 @@ ...@@ -68,11 +68,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># XXX need to implement this part in the catalog\n <value> <string>def test(movement):\n
# portal type causality of root applied rule\n
kw[\'explanation_portal_type\'] = \'Production Order\'\n
\n
def test(movement):\n
root_applied_rule = movement.getRootAppliedRule()\n root_applied_rule = movement.getRootAppliedRule()\n
root_rule = root_applied_rule.getSpecialiseValue()\n root_rule = root_applied_rule.getSpecialiseValue()\n
root_movement = movement.getRootSimulationMovement()\n root_movement = movement.getRootSimulationMovement()\n
...@@ -85,14 +81,23 @@ def test(movement):\n ...@@ -85,14 +81,23 @@ def test(movement):\n
root_movement.getSimulationState() == "confirmed"\n root_movement.getSimulationState() == "confirmed"\n
)\n )\n
\n \n
kw.update(context.portal_catalog.buildSQLQuery(**kw))\n # XXX need to implement this part in the catalog\n
# portal type causality of root applied rule\n
search_kw = {\n
\'explanation_portal_type\': \'Production Order\',\n
\'resource_portal_type\': \'Simulation Movement\',\n
}\n
if explanation_uid is not None:\n
search_kw[\'explanation_uid\'] = explanation_uid\n
\n \n
search_kw.update(context.portal_catalog.buildSQLQuery(**search_kw))\n
context.log(context.ProductionOrder_zSelectMovement(src__=1, **search_kw))\n
if src__==0:\n if src__==0:\n
movement_list = [x.getObject() for x in context.ProductionOrder_zSelectMovement(**kw)]\n movement_list = [x.getObject() for x in context.ProductionOrder_zSelectMovement(**search_kw)]\n
movement_list = [x for x in movement_list if test(x)]\n movement_list = [x for x in movement_list if test(x)]\n
return movement_list\n return movement_list\n
else:\n else:\n
return context.ProductionOrder_zSelectMovement(src__=1, **kw)\n return context.ProductionOrder_zSelectMovement(src__=1, **search_kw)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -109,7 +114,7 @@ else:\n ...@@ -109,7 +114,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>src__=0, **kw</string> </value> <value> <string>explanation_uid=None, src__=0, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -129,16 +134,19 @@ else:\n ...@@ -129,16 +134,19 @@ else:\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>explanation_uid</string>
<string>src__</string> <string>src__</string>
<string>kw</string> <string>kw</string>
<string>_write_</string>
<string>test</string> <string>test</string>
<string>search_kw</string>
<string>None</string>
<string>_write_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>_apply_</string> <string>_apply_</string>
<string>context</string> <string>context</string>
...@@ -159,6 +167,7 @@ else:\n ...@@ -159,6 +167,7 @@ else:\n
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple> <tuple>
<none/>
<int>0</int> <int>0</int>
</tuple> </tuple>
</value> </value>
......
30 34
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment