Commit bc07fe48 authored by Jérome Perrin's avatar Jérome Perrin

rename Item_getVariationOnMovement into Item_getVariationCategoryList and...

rename Item_getVariationOnMovement into Item_getVariationCategoryList and introduce Item_getVariationRangeCategoryItemList.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27097 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 96ca4cc1
...@@ -119,10 +119,11 @@ for item in object_list:\n ...@@ -119,10 +119,11 @@ for item in object_list:\n
pl_line_dict[\'resource_value\'] = resource\n pl_line_dict[\'resource_value\'] = resource\n
pl_line_dict[\'source_value\'] = source\n pl_line_dict[\'source_value\'] = source\n
pl_line_value = pl_value.newContent(**pl_line_dict)\n pl_line_value = pl_value.newContent(**pl_line_dict)\n
if item.Item_getVariationOnMovement()==[]:\n variation_category_list = item.Item_getVariationCategoryList()\n
if not variation_category_list:\n
pl_line_value.setAggregateValue(item)\n pl_line_value.setAggregateValue(item)\n
else:\n else:\n
pl_line_value.setVariationCategoryList(item.Item_getVariationOnMovement(current=1))\n pl_line_value.setVariationCategoryList(variation_category_list)\n
base_id = \'movement\'\n base_id = \'movement\'\n
cell_key_list = list(pl_line_value.getCellKeyList(base_id=base_id))\n cell_key_list = list(pl_line_value.getCellKeyList(base_id=base_id))\n
cell_key_list.sort()\n cell_key_list.sort()\n
...@@ -220,6 +221,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -220,6 +221,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>resource</string> <string>resource</string>
<string>pl_line_dict</string> <string>pl_line_dict</string>
<string>pl_line_value</string> <string>pl_line_value</string>
<string>variation_category_list</string>
<string>base_id</string> <string>base_id</string>
<string>list</string> <string>list</string>
<string>cell_key_list</string> <string>cell_key_list</string>
......
...@@ -82,10 +82,11 @@ pl_value = module.newContent(**pl_dict)\n ...@@ -82,10 +82,11 @@ pl_value = module.newContent(**pl_dict)\n
\n \n
pl_line_value = pl_value.newContent(**pl_line_dict)\n pl_line_value = pl_value.newContent(**pl_line_dict)\n
pl_line_value.setResourceValue(context.Item_getResourceValue())\n pl_line_value.setResourceValue(context.Item_getResourceValue())\n
if context.Item_getVariationOnMovement()==[]:\n variation_category_list = context.Item_getVariationCategoryList()\n
if not variation_category_list:\n
pl_line_value.setAggregateValue(context)\n pl_line_value.setAggregateValue(context)\n
else:\n else:\n
pl_line_value.setVariationCategoryList(context.Item_getVariationOnMovement(current=1))\n pl_line_value.setVariationCategoryList(variation_category_list)\n
base_id = \'movement\'\n base_id = \'movement\'\n
cell_key_list = list(pl_line_value.getCellKeyList(base_id=base_id))\n cell_key_list = list(pl_line_value.getCellKeyList(base_id=base_id))\n
cell_key_list.sort()\n cell_key_list.sort()\n
...@@ -166,6 +167,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n ...@@ -166,6 +167,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n
<string>_apply_</string> <string>_apply_</string>
<string>pl_value</string> <string>pl_value</string>
<string>pl_line_value</string> <string>pl_line_value</string>
<string>variation_category_list</string>
<string>base_id</string> <string>base_id</string>
<string>list</string> <string>list</string>
<string>cell_key_list</string> <string>cell_key_list</string>
......
...@@ -55,22 +55,21 @@ ...@@ -55,22 +55,21 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n <value> <string>from DateTime import DateTime\n
\n \n
#kw[\'at_date\'] = DateTime()\n kw[\'at_date\'] = DateTime()\n
kw[\'item\'] = context.getRelativeUrl()\n kw[\'item\'] = context.getRelativeUrl()\n
\n \n
last_affectation_list = context.portal_simulation.getTrackingList(**kw)\n last_affectation_list = context.portal_simulation.getCurrentTrackingList(**kw)\n
\n \n
if kw.get(\'src__\',0):\n if kw.get(\'src__\',0):\n
return last_affectation_list\n return last_affectation_list\n
\n
if len(last_affectation_list):\n if len(last_affectation_list):\n
last_affectation = last_affectation_list[0]\n last_affectation = last_affectation_list[0]\n
if last_affectation.resource_uid is not None:\n if last_affectation.delivery_uid is not None:\n
resource_value = context.portal_catalog.getObject(last_affectation.resource_uid)\n movement = context.portal_catalog.getObject(last_affectation.delivery_uid)\n
mvt_aggregated = context.getAggregateRelatedValue()\n return movement.getVariationCategoryList()\n
variation_list = mvt_aggregated.getVariationCategoryList()\n
return variation_list\n
\n \n
return None\n return []\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -109,18 +108,16 @@ return None\n ...@@ -109,18 +108,16 @@ return None\n
<tuple> <tuple>
<string>kw</string> <string>kw</string>
<string>DateTime</string> <string>DateTime</string>
<string>_write_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>_write_</string>
<string>_apply_</string> <string>_apply_</string>
<string>last_affectation_list</string> <string>last_affectation_list</string>
<string>len</string> <string>len</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>last_affectation</string> <string>last_affectation</string>
<string>None</string> <string>None</string>
<string>resource_value</string> <string>movement</string>
<string>mvt_aggregated</string>
<string>variation_list</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -137,7 +134,7 @@ return None\n ...@@ -137,7 +134,7 @@ return None\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Item_getVariationOnMovement</string> </value> <value> <string>Item_getVariationCategoryList</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n
\n
kw[\'at_date\'] = DateTime()\n
kw[\'item\'] = context.getRelativeUrl()\n
\n
last_affectation_list = context.portal_simulation.getCurrentTrackingList(**kw)\n
\n
if kw.get(\'src__\',0):\n
return last_affectation_list\n
if len(last_affectation_list):\n
last_affectation = last_affectation_list[0]\n
if last_affectation.delivery_uid is not None:\n
movement = context.portal_catalog.getObject(last_affectation.delivery_uid)\n
return movement.getVariationRangeCategoryItemList(display_base_category=0)\n
\n
return []\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>DateTime</string>
<string>_write_</string>
<string>_getattr_</string>
<string>context</string>
<string>_apply_</string>
<string>last_affectation_list</string>
<string>len</string>
<string>_getitem_</string>
<string>last_affectation</string>
<string>None</string>
<string>movement</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Item_getVariationRangeCategoryItemList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.Item_getVariationOnMovement()</string> </value> <value> <string>here/Item_getVariationCategoryList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.getAggregateRelatedValue().getVariationRangeCategoryItemList(display_base_category = 0)</string> </value> <value> <string>here/Item_getVariationRangeCategoryItemList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -68,9 +68,11 @@ new_list = filter(\n ...@@ -68,9 +68,11 @@ new_list = filter(\n
result)\n result)\n
\n \n
splc_list= context.contentValues(portal_type=cell_portal_type)\n splc_list= context.contentValues(portal_type=cell_portal_type)\n
if not splc_list:\n
return new_list\n
for splc in splc_list:\n for splc in splc_list:\n
item_list = filter(\n item_list = filter(\n
lambda x :(x.Item_getVariationOnMovement()==splc.getVariationCategoryList()),\n lambda x :(x.Item_getVariationCategoryList()==splc.getVariationCategoryList()),\n
new_list)\n new_list)\n
result_list.extend(item_list)\n result_list.extend(item_list)\n
len_res_list = len(result_list)\n len_res_list = len(result_list)\n
...@@ -80,7 +82,7 @@ result = []\n ...@@ -80,7 +82,7 @@ result = []\n
\n \n
return result_list\n return result_list\n
for item in result_list:\n for item in result_list:\n
variation_list = item.Item_getVariationOnMovement()\n variation_list = item.Item_getVariationCategoryList()\n
if variation_list !=[]:\n if variation_list !=[]:\n
obj = newTempBase(portal,id="tmp_item_%s" % item.getId(), uid="new_item_%s" % item.getId())\n obj = newTempBase(portal,id="tmp_item_%s" % item.getId(), uid="new_item_%s" % item.getId())\n
obj.edit(title=item.Item_getResourceTitle(),\n obj.edit(title=item.Item_getResourceTitle(),\n
......
...@@ -81,7 +81,7 @@ for item in item_list: \n ...@@ -81,7 +81,7 @@ for item in item_list: \n
variation_dict[variation_list] = variation_dict[variation_list] + item.getQuantity()\n variation_dict[variation_list] = variation_dict[variation_list] + item.getQuantity()\n
for cell in splc_list:\n for cell in splc_list:\n
for item in item_list:\n for item in item_list:\n
if item.Item_getVariationOnMovement()==cell.getVariationCategoryList():\n if item.Item_getVariationCategoryList() == cell.getVariationCategoryList():\n
new_item_list=[]\n new_item_list=[]\n
new_item_list.append(item) \n new_item_list.append(item) \n
cell.setAggregateValueList(context.getAggregateValueList()+ new_item_list)\n cell.setAggregateValueList(context.getAggregateValueList()+ new_item_list)\n
......
78 84
\ 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