Commit 73ac2399 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Fix stock listbox and add a new column 'order'.

parent 142a6384
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</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 encoding="cdata"><![CDATA[
def getOrderStr(movement_list, resource_value):\n
order_str = \'\'\n
sum_quantity = movement_idx = 0\n
for movement_idx, movement in enumerate(movement_list):\n
quantity = movement.getQuantity()\n
quantity_unit_value = movement.getQuantityUnitValue()\n
if quantity_unit_value is None:\n
continue\n
\n
order_str += \'%s%.f%s\' % (movement_idx and \', \' or \'\', quantity,\n
quantity_unit_value.getShortTitle())\n
\n
sum_quantity += resource_value.convertQuantity(quantity,\n
movement.getQuantityUnit(),\n
resource_value.getDefaultQuantityUnit())\n
\n
if movement_idx > 0:\n
order_str += \' \' + context.Base_translateString(\'(${quantity}${quantity_unit} total)\',\n
mapping={\'quantity\': sum_quantity,\n
\'quantity_unit\': resource_value.getShortTitle()})\n
\n
return order_str\n
\n
movement_dict = {}\n
for movement in context.getMovementList():\n
movement_dict_key = movement.getResourceUid(), tuple(sorted(movement.getVariationCategoryList()))\n
if movement_dict_key in movement_dict:\n
movement_dict[movement_dict_key].append(movement)\n
else:\n
movement_dict[movement_dict_key] = [movement]\n
\n
line_list = []\n
order_dict = {}\n
for inventory in context.getFutureInventoryList(*args, **kwargs):\n
resource_value = inventory.getResourceValue()\n
dict_key = resource_value.getUid(), tuple(sorted(inventory.getVariationCategoryList()))\n
\n
try:\n
movement_list = movement_dict[dict_key]\n
del movement_dict[dict_key]\n
except KeyError:\n
pass\n
else:\n
order_dict[inventory.getUid()] = getOrderStr(movement_list, resource_value)\n
\n
line_list.append(inventory)\n
\n
if movement_dict:\n
for movement_list in movement_dict.values():\n
for movement in movement_list:\n
resource_value = movement.getResourceValue()\n
if resource_value is None:\n
continue\n
\n
temp_movement = movement.asContext(getCurrentInventory=str,\n
getAvailableInventory=str,\n
inventory=\'\')\n
\n
order_dict[movement.getUid()] = getOrderStr([movement], resource_value)\n
line_list.append(temp_movement)\n
\n
context.REQUEST.set(\'order_dict\', order_dict)\n
\n
return line_list\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*args, **kwargs</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery_getStockList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -82,7 +82,8 @@
<value>
<list>
<string>listbox_variation_category_item_list</string>
<string>listbox_order_quantity_unit</string>
<string>listbox_order_item</string>
<string>listbox_quantity_unit_item</string>
</list>
</value>
</item>
......
......@@ -131,16 +131,12 @@
<string>Resource</string>
</tuple>
<tuple>
<string>variation_category_item_list</string>
<string>Variation</string>
</tuple>
<tuple>
<string>getQuantity</string>
<string>Order Quantity</string>
<string>order_item</string>
<string>Order</string>
</tuple>
<tuple>
<string>order_quantity_unit</string>
<string>Order Quantity Unit</string>
<string>variation_category_item_list</string>
<string>Variation</string>
</tuple>
<tuple>
<string>getCurrentInventory</string>
......@@ -155,7 +151,7 @@
<string>Future</string>
</tuple>
<tuple>
<string>getQuantityUnit</string>
<string>quantity_unit_item</string>
<string>Unit</string>
</tuple>
</list>
......@@ -192,10 +188,6 @@
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>order_quantity_unit</string>
<string>Order Quantity Unit</string>
</tuple>
<tuple>
<string>variation_category_item_list</string>
<string>Variation</string>
......@@ -273,7 +265,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>getFutureInventoryList</string> </value>
<value> <string>Delivery_getStockList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -10,13 +10,14 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_order_quantity_unit</string> </value>
<value> <string>listbox_order_item</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -52,6 +53,12 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -61,13 +68,11 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -77,18 +82,26 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_listbox_quantity_unit</string> </value>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewTradeFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>listbox_order_item</string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -103,7 +116,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(x.getTranslatedLogicalPath(), x.getCategoryRelativeUrl(base=0)) for x in cell.getResourceValue().getQuantityUnitValueList()] or [(\'\', \'\')]</string> </value>
<value> <string>python: here.REQUEST.get(\'order_dict\').get(cell.getUid(), \'\')</string> </value>
</item>
</dictionary>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>display_width</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_quantity_unit_item</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</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>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>listbox_quantity_unit_item</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.getResourceValue().getQuantityUnitTranslatedTitle()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2011-05-27 arnaud.fontaine
* Fix stock listbox and add a new column 'order'.
2011-04-14 yusei
* Remove old unnecessary tales expression from relation string fields.
......
1125
\ No newline at end of file
1126
\ 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