Commit 55a03d29 authored by Jérome Perrin's avatar Jérome Perrin

fix stock report by site with items, it was not working when multiple movements were moving items

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41320 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2504d127
......@@ -10,12 +10,12 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>columns</string>
<string>editable_columns</string>
<string>title</string>
<string>selection_name</string>
<string>list_method</string>
<string>selection_name</string>
<string>sort_columns</string>
<string>columns</string>
<string>title</string>
</list>
</value>
</item>
......@@ -63,6 +63,10 @@
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -71,10 +75,26 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -179,7 +199,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: field.get_orig_value(\'columns\') + (context.REQUEST.form.get("item_stock") == 1 and [(\'aggregate_title_list\',\'Items aggregated\')] or [])</string> </value>
<value> <string>python: field.get_orig_value(\'columns\') + (context.REQUEST.form.get("item_stock") == 1 and [(\'aggregate_title_list\', \'Aggregated Items\')] or [])</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -109,7 +109,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.Inventory_getAggregatedItemList()</string> </value>
<value> <string>python: cell.Inventory_getAggregatedItemList(at_date=request[\'at_date\'])</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -50,40 +50,35 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Document import newTempBase\n
from Products.ERP5Type.Utils import cartesianProduct\n
from DateTime import DateTime\n
<value> <string>from DateTime import DateTime\n
portal = context.getPortalObject()\n
request = portal.REQUEST\n
#at_date = DateTime(request.form["at_date"].Date())\n
at_date = DateTime().Date()\n
\n
tracking_parameters = {\n
\'node_uid\': context.node_uid,\n
\'resource_uid\': context.getResourceUid(),\n
\'section_uid\' : context.section_uid,\n
\'at_date\': context.getStartDate(),\n
\'output\': 1,\n
}\n
if not at_date:\n
at_date=DateTime()\n
\n
brain = context\n
\n
tracking_parameters = dict(\n
node_uid=brain.node_uid,\n
resource_uid=brain.resource_uid,\n
at_date=at_date,\n
output=True,)\n
\n
result_list = []\n
item_dict ={}\n
check_variation = bool(context.getVariationCategoryList())\n
\n
if check_variation==True and context.getPortalType()!=\'Simulation Movement\':\n
acceptable_variation_category_list = \\\n
cartesianProduct(context.getObject().getCellRange(base_id=\'movement\'))\n
\n
for tracking_brain in portal.portal_simulation.getCurrentTrackingList(\n
current_variation = context.getVariationCategoryList()\n
\n
for tracking_brain in portal.portal_simulation.getCurrentTrackingList(\n
**tracking_parameters):\n
item = tracking_brain.getObject()\n
\n
item = tracking_brain.getObject()\n
\n
if current_variation and\\\n
item.Item_getVariationCategoryList(at_date=at_date) != current_variation:\n
continue\n
\n
if check_variation and \\\n
item.Item_getVariationCategoryList(at_date=context.getStartDate())\\\n
!=context.getVariationCategoryList():\n
continue\n
item_dict = "%s : %s"%(item.getReference(),item.getQuantity(at_date=at_date))\n
result_list.append(item_dict)\n
item_dict = "%s : %s"% ( item.getReference(), item.getQuantity(at_date=at_date) )\n
result_list.append(item_dict)\n
\n
return result_list\n
</string> </value>
......@@ -96,7 +91,7 @@ return result_list\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>at_date=None, site=None, positive_stock=None, negative_stock=None, zero_stock=None, **kw</string> </value>
<value> <string>at_date=None, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -116,38 +111,30 @@ return result_list\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>5</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>at_date</string>
<string>site</string>
<string>positive_stock</string>
<string>negative_stock</string>
<string>zero_stock</string>
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>Products.ERP5Type.Utils</string>
<string>cartesianProduct</string>
<string>DateTime</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>request</string>
<string>brain</string>
<string>dict</string>
<string>True</string>
<string>tracking_parameters</string>
<string>result_list</string>
<string>item_dict</string>
<string>bool</string>
<string>check_variation</string>
<string>True</string>
<string>acceptable_variation_category_list</string>
<string>current_variation</string>
<string>_getiter_</string>
<string>_apply_</string>
<string>tracking_brain</string>
<string>item</string>
<string>item_dict</string>
</tuple>
</value>
</item>
......@@ -161,10 +148,6 @@ return result_list\n
<value>
<tuple>
<none/>
<none/>
<none/>
<none/>
<none/>
</tuple>
</value>
</item>
......
1078
\ No newline at end of file
1080
\ 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