Commit 34ee2d50 authored by Mame Coumba Sall's avatar Mame Coumba Sall

2008-12-17 mame

* Modify script to not display stock of the resource when it's positive, negative or equal to zero

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24919 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24793288
......@@ -62,13 +62,13 @@ def mycmp(line_a, line_b):\n
Compare 2 lines and sort them according to\n
sort_on parameter.\n
"""\n
\n
result = cmp(line_a.getResourceReference(), line_b.getResourceReference())\n
if result == 0:\n
result = cmp(line_a.variation_text, line_b.variation_text)\n
if result == 0:\n
result = cmp(line_a.resource_title, line_b.resource_title)\n
return result\n
\n
result_list = []\n
for x in context.portal_simulation.getCurrentInventoryList(\n
stock_node_category_uid=site.getUid(),\n
......@@ -79,12 +79,14 @@ for x in context.portal_simulation.getCurrentInventoryList(\n
# XXX resourceType= uses movement table.\n
# resource_portal_type= does not work with cells (because resource is acquired from line)\n
resourceType=context.getPortalProductTypeList(), **kw):\n
if positive_stock and x.getInventory() > 0:\n
result_list.append(x)\n
if negative_stock and x.getInventory() < 0:\n
result_list.append(x)\n
if zero_stock and x.getInventory()==0:\n
result_list.append(x)\n
if x.inventory <=0 and positive_stock:\n
result_list.append(x)\n
if x.inventory>=0 and negative_stock:\n
result_list.append(x)\n
if x.inventory!=0 and zero_stock:\n
result_list.append(x) \n
if not positive_stock and not negative_stock and not zero_stock:\n
result_list.append(x)\n
\n
result_list = list(result_list)\n
result_list.sort(cmp=mycmp)\n
......
......@@ -14,6 +14,7 @@
<value>
<list>
<string>title</string>
<string>description</string>
</list>
</value>
</item>
......@@ -74,6 +75,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Don\'t display the negative stock of the resource if stock is negative</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
......@@ -88,7 +93,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Negative Stock</string> </value>
<value> <string>Don\'t Display Negative Stock</string> </value>
</item>
</dictionary>
</value>
......
......@@ -14,6 +14,7 @@
<value>
<list>
<string>title</string>
<string>description</string>
</list>
</value>
</item>
......@@ -74,6 +75,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Don\'t display positive stock of the resource if stock is positive</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
......@@ -88,7 +93,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Positive Stock</string> </value>
<value> <string>Don\'t Display Positive Stock</string> </value>
</item>
</dictionary>
</value>
......
......@@ -14,6 +14,7 @@
<value>
<list>
<string>title</string>
<string>description</string>
</list>
</value>
</item>
......@@ -74,6 +75,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Don\'t display zero stock of the resource if stock is equal to zero</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
......@@ -88,7 +93,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Zero Stock</string> </value>
<value> <string>Don\'t Display Zero Stock</string> </value>
</item>
</dictionary>
</value>
......
550
\ No newline at end of file
551
\ 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