From bc07fe481034914f0856128a8b1e0273b7360352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Fri, 22 May 2009 13:00:39 +0000 Subject: [PATCH] rename Item_getVariationOnMovement into Item_getVariationCategoryList and introduce Item_getVariationRangeCategoryItemList. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27097 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ItemModule_createDeliveryLine.xml | 6 +- .../erp5_item/Item_createDeliveryLine.xml | 6 +- ....xml => Item_getVariationCategoryList.xml} | 23 ++- ...Item_getVariationRangeCategoryItemList.xml | 147 ++++++++++++++++++ .../Item_view/my_variation_category_list.xml | 4 +- ...PackingList_getSelectFastInputItemList.xml | 6 +- ...kingList_setItemForSelectFastInputList.xml | 2 +- bt5/erp5_item/bt/revision | 2 +- 8 files changed, 173 insertions(+), 23 deletions(-) rename bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/{Item_getVariationOnMovement.xml => Item_getVariationCategoryList.xml} (87%) create mode 100644 bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationRangeCategoryItemList.xml diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/ItemModule_createDeliveryLine.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/ItemModule_createDeliveryLine.xml index 3c531d7cd1..ba286657cc 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/ItemModule_createDeliveryLine.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/ItemModule_createDeliveryLine.xml @@ -119,10 +119,11 @@ for item in object_list:\n pl_line_dict[\'resource_value\'] = resource\n pl_line_dict[\'source_value\'] = source\n pl_line_value = pl_value.newContent(**pl_line_dict)\n - if item.Item_getVariationOnMovement()==[]:\n + variation_category_list = item.Item_getVariationCategoryList()\n + if not variation_category_list:\n pl_line_value.setAggregateValue(item)\n else:\n - pl_line_value.setVariationCategoryList(item.Item_getVariationOnMovement(current=1))\n + pl_line_value.setVariationCategoryList(variation_category_list)\n base_id = \'movement\'\n cell_key_list = list(pl_line_value.getCellKeyList(base_id=base_id))\n cell_key_list.sort()\n @@ -220,6 +221,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n <string>resource</string> <string>pl_line_dict</string> <string>pl_line_value</string> + <string>variation_category_list</string> <string>base_id</string> <string>list</string> <string>cell_key_list</string> diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_createDeliveryLine.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_createDeliveryLine.xml index a96a16791c..61bca112fb 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_createDeliveryLine.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_createDeliveryLine.xml @@ -82,10 +82,11 @@ pl_value = module.newContent(**pl_dict)\n \n pl_line_value = pl_value.newContent(**pl_line_dict)\n pl_line_value.setResourceValue(context.Item_getResourceValue())\n -if context.Item_getVariationOnMovement()==[]:\n +variation_category_list = context.Item_getVariationCategoryList()\n +if not variation_category_list:\n pl_line_value.setAggregateValue(context)\n else:\n - pl_line_value.setVariationCategoryList(context.Item_getVariationOnMovement(current=1))\n + pl_line_value.setVariationCategoryList(variation_category_list)\n base_id = \'movement\'\n cell_key_list = list(pl_line_value.getCellKeyList(base_id=base_id))\n cell_key_list.sort()\n @@ -166,6 +167,7 @@ return context.Base_redirect(form_id, keep_items=dict(\n <string>_apply_</string> <string>pl_value</string> <string>pl_line_value</string> + <string>variation_category_list</string> <string>base_id</string> <string>list</string> <string>cell_key_list</string> diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationOnMovement.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationCategoryList.xml similarity index 87% rename from bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationOnMovement.xml rename to bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationCategoryList.xml index 26cddc868e..cab77bf826 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationOnMovement.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationCategoryList.xml @@ -55,22 +55,21 @@ <key> <string>_body</string> </key> <value> <string>from DateTime import DateTime\n \n -#kw[\'at_date\'] = DateTime()\n +kw[\'at_date\'] = DateTime()\n kw[\'item\'] = context.getRelativeUrl()\n \n -last_affectation_list = context.portal_simulation.getTrackingList(**kw)\n +last_affectation_list = context.portal_simulation.getCurrentTrackingList(**kw)\n \n if kw.get(\'src__\',0):\n return last_affectation_list\n +\n if len(last_affectation_list):\n last_affectation = last_affectation_list[0]\n - if last_affectation.resource_uid is not None:\n - resource_value = context.portal_catalog.getObject(last_affectation.resource_uid)\n - mvt_aggregated = context.getAggregateRelatedValue()\n - variation_list = mvt_aggregated.getVariationCategoryList()\n - return variation_list\n + if last_affectation.delivery_uid is not None:\n + movement = context.portal_catalog.getObject(last_affectation.delivery_uid)\n + return movement.getVariationCategoryList()\n \n -return None\n +return []\n </string> </value> </item> <item> @@ -109,18 +108,16 @@ return None\n <tuple> <string>kw</string> <string>DateTime</string> + <string>_write_</string> <string>_getattr_</string> <string>context</string> - <string>_write_</string> <string>_apply_</string> <string>last_affectation_list</string> <string>len</string> <string>_getitem_</string> <string>last_affectation</string> <string>None</string> - <string>resource_value</string> - <string>mvt_aggregated</string> - <string>variation_list</string> + <string>movement</string> </tuple> </value> </item> @@ -137,7 +134,7 @@ return None\n </item> <item> <key> <string>id</string> </key> - <value> <string>Item_getVariationOnMovement</string> </value> + <value> <string>Item_getVariationCategoryList</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationRangeCategoryItemList.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationRangeCategoryItemList.xml new file mode 100644 index 0000000000..57770578f6 --- /dev/null +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getVariationRangeCategoryItemList.xml @@ -0,0 +1,147 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </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>from DateTime import DateTime\n +\n +kw[\'at_date\'] = DateTime()\n +kw[\'item\'] = context.getRelativeUrl()\n +\n +last_affectation_list = context.portal_simulation.getCurrentTrackingList(**kw)\n +\n +if kw.get(\'src__\',0):\n + return last_affectation_list\n +if len(last_affectation_list):\n + last_affectation = last_affectation_list[0]\n + if last_affectation.delivery_uid is not None:\n + movement = context.portal_catalog.getObject(last_affectation.delivery_uid)\n + return movement.getVariationRangeCategoryItemList(display_base_category=0)\n +\n +return []\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>**kw</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>kw</string> + <string>DateTime</string> + <string>_write_</string> + <string>_getattr_</string> + <string>context</string> + <string>_apply_</string> + <string>last_affectation_list</string> + <string>len</string> + <string>_getitem_</string> + <string>last_affectation</string> + <string>None</string> + <string>movement</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Item_getVariationRangeCategoryItemList</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_view/my_variation_category_list.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_view/my_variation_category_list.xml index 7d5de4c495..6484b21518 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_view/my_variation_category_list.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_view/my_variation_category_list.xml @@ -295,7 +295,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.Item_getVariationOnMovement()</string> </value> + <value> <string>here/Item_getVariationCategoryList</string> </value> </item> </dictionary> </pickle> @@ -311,7 +311,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.getAggregateRelatedValue().getVariationRangeCategoryItemList(display_base_category = 0)</string> </value> + <value> <string>here/Item_getVariationRangeCategoryItemList</string> </value> </item> </dictionary> </pickle> 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 0429e4912f..2f9168bc62 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 @@ -68,9 +68,11 @@ new_list = filter(\n result)\n \n splc_list= context.contentValues(portal_type=cell_portal_type)\n +if not splc_list:\n + return new_list\n for splc in splc_list:\n item_list = filter(\n - lambda x :(x.Item_getVariationOnMovement()==splc.getVariationCategoryList()),\n + lambda x :(x.Item_getVariationCategoryList()==splc.getVariationCategoryList()),\n new_list)\n result_list.extend(item_list)\n len_res_list = len(result_list)\n @@ -80,7 +82,7 @@ result = []\n \n return result_list\n for item in result_list:\n - variation_list = item.Item_getVariationOnMovement()\n + variation_list = item.Item_getVariationCategoryList()\n if variation_list !=[]:\n obj = newTempBase(portal,id="tmp_item_%s" % item.getId(), uid="new_item_%s" % item.getId())\n obj.edit(title=item.Item_getResourceTitle(),\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 807a29e75f..30b22a4889 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 @@ -81,7 +81,7 @@ for item in item_list: \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 + if item.Item_getVariationCategoryList() == cell.getVariationCategoryList():\n new_item_list=[]\n new_item_list.append(item) \n cell.setAggregateValueList(context.getAggregateValueList()+ new_item_list)\n diff --git a/bt5/erp5_item/bt/revision b/bt5/erp5_item/bt/revision index efee1f88bb..3ca9062a11 100644 --- a/bt5/erp5_item/bt/revision +++ b/bt5/erp5_item/bt/revision @@ -1 +1 @@ -78 \ No newline at end of file +84 \ No newline at end of file -- 2.30.9