[Erp5-report] r27251 - in /erp5/trunk/bt5/erp5_item: SkinTemplateItem/portal_skins/erp5_ite...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri May 29 15:29:22 CEST 2009
Author: jerome
Date: Fri May 29 15:29:20 2009
New Revision: 27251
URL: http://svn.erp5.org?rev=27251&view=rev
Log:
fast inputs to create or select items now update all movements to set the quantities to the sum of selected item quantities
Modified:
erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml
erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_selectItemList.xml
erp5/trunk/bt5/erp5_item/bt/revision
Modified: erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml?rev=27251&r1=27250&r2=27251&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml [utf8] Fri May 29 15:29:20 2009
@@ -53,7 +53,9 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>from Products.ERP5Type.Message import translateString\n
+ <value> <string encoding="cdata"><![CDATA[
+
+from Products.ERP5Type.Message import translateString\n
item_list = []\n
request = context.REQUEST\n
total_quantity = 0.0\n
@@ -68,16 +70,17 @@
cell_portal_type = \'Internal Packing List Cell\'\n
\n
movement_cell_list = context.contentValues(portal_type=cell_portal_type)\n
-update_quantity = not context.Movement_isQuantityEditable()\n
base_id = \'movement\'\n
+\n
for line in kw.get(\'listbox\'):\n
- if line.has_key(\'listbox_key\') and line[\'quantity\'] in (\'\',None):\n
- msg = translateString("Please Define Quantity for Item Defined On Line ${line_id}",\n
+\n
+ if line.has_key(\'listbox_key\') and (line[\'title\'] or line[\'reference\'] not in (\'\', None)):\n
+\n
+ if line[\'quantity\'] in (\'\',None):\n
+ msg = translateString("Please Define Quantity for Item Defined On Line ${line_id}",\n
mapping={\'line_id\': line[\'listbox_key\']})\n
- raise NotImplementedError(\n
- msg)\n
-\n
- if line.has_key(\'listbox_key\') and (line[\'title\'] or line[\'reference\'] not in (\'\', None)):\n
+ raise NotImplementedError(msg)\n
+\n
module = context.getDefaultModule(type)\n
item = module.newContent(portal_type=type,\n
title=line[\'title\'],\n
@@ -114,13 +117,31 @@
if item not in movement_to_update.getAggregateValueList():\n
movement_to_update.setAggregateValueSet(\n
movement_to_update.getAggregateValueList() + [item])\n
- if update_quantity:\n
- movement_to_update.setQuantity(\n
- movement_to_update.getQuantity() + item.getQuantity())\n
+\n
+\n
+update_quantity = not context.Movement_isQuantityEditable()\n
+if update_quantity:\n
+ if context.isMovement():\n
+ movement_list = context,\n
+ else:\n
+ movement_list = context.getCellValueList(base_id=\'movement\')\n
+ for movement in movement_list:\n
+ quantity = 0\n
+ item_list = movement.getAggregateValueList()\n
+ for item in item_list:\n
+ if item.getQuantityUnit() != movement.getQuantityUnit():\n
+ if len(item_list) > 1:\n
+ raise NotImplementedError(\n
+ \'Quantity unit from the movement differs from quantity\'\n
+ \' unit on the item\')\n
+ quantity += item.getQuantity()\n
+ movement.setQuantity(quantity)\n
\n
return context.Base_redirect(form_id, keep_items=dict(\n
portal_status_message=translateString(\'Items created\')))\n
-</string> </value>
+
+
+]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
@@ -169,7 +190,6 @@
<string>type</string>
<string>cell_portal_type</string>
<string>movement_cell_list</string>
- <string>update_quantity</string>
<string>base_id</string>
<string>_getiter_</string>
<string>line</string>
@@ -184,6 +204,12 @@
<string>movement_to_update</string>
<string>variation_category_list</string>
<string>variation</string>
+ <string>update_quantity</string>
+ <string>movement_list</string>
+ <string>movement</string>
+ <string>quantity</string>
+ <string>len</string>
+ <string>_inplacevar_</string>
<string>dict</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_selectItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_selectItemList.xml?rev=27251&r1=27250&r2=27251&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_selectItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_selectItemList.xml [utf8] Fri May 29 15:29:20 2009
@@ -53,7 +53,9 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>from Products.ERP5Type.Message import translateString\n
+ <value> <string encoding="cdata"><![CDATA[
+
+from Products.ERP5Type.Message import translateString\n
item_list = []\n
request = context.REQUEST\n
portal = context.getPortalObject()\n
@@ -81,7 +83,6 @@
list_selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request)\n
uids = selection_tool.getSelectionCheckedUidsFor(list_selection_name)\n
\n
-update_quantity = not context.Movement_isQuantityEditable()\n
\n
for item_uid in uids:\n
item = getObject(item_uid)\n
@@ -109,26 +110,38 @@
*item_variation)\n
movement_to_update.edit(mapped_value_property_list=(\'quantity\', \'price\'),\n
variation_category_list=item_variation,)\n
-\n
else:\n
# no variation, we\'ll update the line itself\n
movement_to_update = context\n
\n
- if item not in movement_to_update.getAggregateValueList():\n
- movement_to_update.setAggregateValueSet(\n
+ movement_to_update.setAggregateValueSet(\n
movement_to_update.getAggregateValueList() + [item])\n
- if update_quantity:\n
- if item.getQuantityUnit() != movement_to_update.getQuantityUnit():\n
- raise NotImplementedError(\n
- \'Quantity unit from the movement differs from quantity\'\n
- \' unit on the item\')\n
- movement_to_update.setQuantity(\n
- movement_to_update.getQuantity() + item.getQuantity())\n
- \n
+\n
+update_quantity = not context.Movement_isQuantityEditable()\n
+if update_quantity:\n
+ if context.isMovement():\n
+ movement_list = context,\n
+ else:\n
+ movement_list = context.getCellValueList(base_id=\'movement\')\n
+ for movement in movement_list:\n
+ quantity = 0\n
+ item_list = movement.getAggregateValueList()\n
+ for item in item_list:\n
+ if item.getQuantityUnit() != movement.getQuantityUnit():\n
+ if len(item_list) > 1:\n
+ raise NotImplementedError(\n
+ \'Quantity unit from the movement differs from quantity\'\n
+ \' unit on the item\')\n
+ else:\n
+ movement.setQuantityUnit(item.getQuantityUnit())\n
+ quantity += item.getQuantity()\n
+ movement.setQuantity(quantity)\n
\n
return context.Base_redirect(form_id, keep_items=dict(\n
portal_status_message=translateString(\'Items aggregated\')))\n
-</string> </value>
+
+
+]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
@@ -183,7 +196,6 @@
<string>line_portal_type</string>
<string>cell_portal_type</string>
<string>NotImplementedError</string>
- <string>update_quantity</string>
<string>_getiter_</string>
<string>item_uid</string>
<string>item</string>
@@ -195,6 +207,12 @@
<string>_apply_</string>
<string>variation_category_list</string>
<string>variation</string>
+ <string>update_quantity</string>
+ <string>movement_list</string>
+ <string>movement</string>
+ <string>quantity</string>
+ <string>len</string>
+ <string>_inplacevar_</string>
<string>dict</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_item/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/bt/revision?rev=27251&r1=27250&r2=27251&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/bt/revision [utf8] Fri May 29 15:29:20 2009
@@ -1,1 +1,1 @@
-151
+153
More information about the Erp5-report
mailing list