From 87f44b77fadcd6c27511fdd7471383afb2305539 Mon Sep 17 00:00:00 2001 From: Mame Coumba Sall <mame@nexedi.com> Date: Wed, 20 May 2009 13:06:16 +0000 Subject: [PATCH] 2009-05-20 mame *add action for fast input of selection of items git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27078 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../select_item_fast_input.xml | 95 +++++++++++++++++++ .../erp5_item/DeliveryLine_createItemList.xml | 1 - ...PackingList_getSelectFastInputItemList.xml | 1 + ...kingList_setItemForSelectFastInputList.xml | 38 ++++++-- bt5/erp5_item/bt/revision | 2 +- bt5/erp5_item/bt/template_action_path_list | 1 + 6 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 bt5/erp5_item/ActionTemplateItem/portal_types/Sale%20Packing%20List%20Line/select_item_fast_input.xml diff --git a/bt5/erp5_item/ActionTemplateItem/portal_types/Sale%20Packing%20List%20Line/select_item_fast_input.xml b/bt5/erp5_item/ActionTemplateItem/portal_types/Sale%20Packing%20List%20Line/select_item_fast_input.xml new file mode 100644 index 0000000000..817e45e078 --- /dev/null +++ b/bt5/erp5_item/ActionTemplateItem/portal_types/Sale%20Packing%20List%20Line/select_item_fast_input.xml @@ -0,0 +1,95 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>category</string> </key> + <value> <string>object_fast_input</string> </value> + </item> + <item> + <key> <string>condition</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>icon</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>select_item_fast_input</string> </value> + </item> + <item> + <key> <string>permissions</string> </key> + <value> + <tuple> + <string>View</string> + </tuple> + </value> + </item> + <item> + <key> <string>priority</string> </key> + <value> <float>4.0</float> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Select Items</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>1</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="Expression" module="Products.CMFCore.Expression"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>text</string> </key> + <value> <string>string:${object_url}/SalePackingList_viewSelectItemFastInputDialog</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <tuple> + <global name="Expression" module="Products.CMFCore.Expression"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>text</string> </key> + <value> <string>python: object.getResource() and object.getResourceValue().getAggregatedPortalTypeList()</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml index 05a2e6576a..797616f2af 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/DeliveryLine_createItemList.xml @@ -67,7 +67,6 @@ elif context.getPortalType()==\'Sale Packing List Line\':\n \n movement_cell_list = context.contentValues(portal_type=cell_portal_type)\n context.setVariationCategoryList([])\n -context.setAggregateValueList([])\n base_id = \'movement\'\n for line in kw.get(\'listbox\'):\n if line.has_key(\'listbox_key\') and line[\'quantity\'] in (\'\',None):\n diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_getSelectFastInputItemList.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_getSelectFastInputItemList.xml index 26b617a77b..0429e4912f 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_getSelectFastInputItemList.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_getSelectFastInputItemList.xml @@ -66,6 +66,7 @@ result_list = []\n new_list = filter(\n lambda x :(x.Item_getResourceTitle()==context.getResourceTitle()),\n result)\n +\n splc_list= context.contentValues(portal_type=cell_portal_type)\n for splc in splc_list:\n item_list = filter(\n diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_setItemForSelectFastInputList.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_setItemForSelectFastInputList.xml index 9f38e1e985..807a29e75f 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_setItemForSelectFastInputList.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/SalePackingList_setItemForSelectFastInputList.xml @@ -53,10 +53,12 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>item_list = []\n + <value> <string>from Products.ERP5Type.Message import translateString\n +item_list = []\n request = context.REQUEST\n total_quantity = 0.0 \n new_item_list =[]\n +context.setAggregateValueList([])\n type = request.get("field_my_type")\n if context.getPortalType()==\'Sale Packing List Line\':\n cell_portal_type = \'Sale Packing List Cell\'\n @@ -71,17 +73,24 @@ for line in kw.get(\'listbox\'): \n item = context.portal_catalog.getResultValue(\n relative_url=line["listbox_key"].split("erp5/")[-1])\n item_list.append(item)\n -\n +variation_dict = {} \n +for item in item_list: \n + variation_list = item.Item_getVariationOnDefinedOnItem()\n + if variation_list not in variation_dict:\n + variation_dict[variation_list] = 0.0 \n + variation_dict[variation_list] = variation_dict[variation_list] + item.getQuantity()\n for cell in splc_list:\n for item in item_list:\n if item.Item_getVariationOnMovement()==cell.getVariationCategoryList():\n new_item_list=[]\n new_item_list.append(item) \n - cell.setAggregateValueList(cell.getAggregateValueList()+new_item_list)\n - item.setQuantity(item.getQuantity()-cell.getQuantity())\n + cell.setAggregateValueList(context.getAggregateValueList()+ new_item_list)\n + variation_cell_list = \',\'.join([x[0] for x in cell.getVariationCategoryItemList()])\n + cell.setQuantity(variation_dict[variation_cell_list])\n \n \n -context.REQUEST.response.redirect(\'%s/view?portal_status_message=%s\' % (context.absolute_url(), \'Items aggregated.\'.replace(\' \', \'%20\')))\n +return context.Base_redirect(form_id, keep_items=dict(\n + portal_status_message=translateString(\'Items aggregated\')))\n </string> </value> </item> <item> @@ -92,7 +101,7 @@ context.REQUEST.response.redirect(\'%s/view?portal_status_message=%s\' % (contex </item> <item> <key> <string>_params</string> </key> - <value> <string>*args, **kw</string> </value> + <value> <string>form_id=\'view\',*args, **kw</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -112,14 +121,17 @@ context.REQUEST.response.redirect(\'%s/view?portal_status_message=%s\' % (contex <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> + <string>form_id</string> <string>args</string> <string>kw</string> + <string>Products.ERP5Type.Message</string> + <string>translateString</string> <string>item_list</string> <string>_getattr_</string> <string>context</string> @@ -134,7 +146,15 @@ context.REQUEST.response.redirect(\'%s/view?portal_status_message=%s\' % (contex <string>line</string> <string>_getitem_</string> <string>item</string> + <string>variation_dict</string> + <string>variation_list</string> + <string>_write_</string> <string>cell</string> + <string>append</string> + <string>$append0</string> + <string>x</string> + <string>variation_cell_list</string> + <string>dict</string> </tuple> </value> </item> @@ -146,7 +166,9 @@ context.REQUEST.response.redirect(\'%s/view?portal_status_message=%s\' % (contex <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <string>view</string> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_item/bt/revision b/bt5/erp5_item/bt/revision index aa92725341..efee1f88bb 100644 --- a/bt5/erp5_item/bt/revision +++ b/bt5/erp5_item/bt/revision @@ -1 +1 @@ -76 \ No newline at end of file +78 \ No newline at end of file diff --git a/bt5/erp5_item/bt/template_action_path_list b/bt5/erp5_item/bt/template_action_path_list index c144524748..40814abe85 100644 --- a/bt5/erp5_item/bt/template_action_path_list +++ b/bt5/erp5_item/bt/template_action_path_list @@ -14,6 +14,7 @@ Returned Sale Packing List | aggregate_item Sale Order Line | item_creation Sale Order | aggregate_item Sale Packing List Line | item_creation +Sale Packing List Line | select_item_fast_input Sale Packing List | aggregate_item Service Report Module | view Service Report | delivery_jump -- 2.30.9