[Erp5-report] r40889 nicolas - in /erp5/trunk/bt5/erp5_item: SkinTemplateItem/portal_skins/...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 29 19:01:50 CET 2010


Author: nicolas
Date: Mon Nov 29 19:01:50 2010
New Revision: 40889

URL: http://svn.erp5.org?rev=40889&view=rev
Log:
Make the Fast input working even if there is no resource defined yet on Delivery Lines.
If all selected items share the same resource, then the resource is also copied from item to Delivery Line.

If a resource is defined on Delivery Line, then the behaviour is unchanged.

Modified:
    erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_selectItemList.xml
    erp5/trunk/bt5/erp5_item/bt/revision

Modified: erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_selectItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_selectItemList.xml?rev=40889&r1=40888&r2=40889&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_selectItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_selectItemList.xml [utf8] Mon Nov 29 19:01:50 2010
@@ -79,6 +79,38 @@ selection_tool.updateSelectionCheckedUid
     list_selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=None)\n
 uids = selection_tool.getSelectionCheckedUidsFor(list_selection_name)\n
 \n
+resource_uid_list = []\n
+message = None\n
+if not context.getResource():\n
+  # Delivery line doesn\'t have resource defined yet.\n
+  # Iterate over all selected items then check if they all\n
+  # share the same resource. If not return to the dialog with warning message\n
+  # otherwise edit the Delivery Line (context) with resource of all items.\n
+  for item_uid in uids:\n
+    item = getObject(item_uid)\n
+    resource_item = item.Item_getResourceValue()\n
+    if resource_item is None:\n
+      message = portal.Base_translateString(\'Selected ${translated_portal_type} has no resource defined\',\n
+                                            mapping={\'translated_portal_type\': item.getTranslatedPortalType().lower()})\n
+      break\n
+    if not resource_uid_list:\n
+      # first item\n
+      resource_uid_list.append(resource_item.getUid())\n
+    elif resource_item.getUid() not in resource_uid_list:\n
+      message = portal.Base_translateString(\'Selected ${translated_portal_type} does not share the same resource\',\n
+                                            mapping={\'translated_portal_type\': item.getTranslatedPortalType().lower()})\n
+      break\n
+  if resource_uid_list and not message:\n
+    # set resource on Delivery Line\n
+    context.setResourceUid(resource_uid_list[0])\n
+if message:\n
+  # means that resource consistency fails.\n
+  # One of Items does not have resource or Items does not share same resource\n
+  # Script stop here\n
+  context.Base_updateDialogForm(listbox=listbox,update=1, kw=kw)\n
+  REQUEST = portal.REQUEST\n
+  REQUEST.set(\'portal_status_message\', message)\n
+  return getattr(context, REQUEST.form[\'dialog_id\'])(listbox=listbox, kw=kw)\n
 \n
 for item_uid in uids:\n
   item = getObject(item_uid)\n
@@ -193,9 +225,15 @@ return context.Base_redirect(form_id, ke
                             <string>cell_portal_type</string>
                             <string>NotImplementedError</string>
                             <string>None</string>
+                            <string>resource_uid_list</string>
+                            <string>message</string>
                             <string>_getiter_</string>
                             <string>item_uid</string>
                             <string>item</string>
+                            <string>resource_item</string>
+                            <string>_getitem_</string>
+                            <string>REQUEST</string>
+                            <string>getattr</string>
                             <string>item_variation</string>
                             <string>cell_found</string>
                             <string>cell</string>

Modified: erp5/trunk/bt5/erp5_item/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_item/bt/revision?rev=40889&r1=40888&r2=40889&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_item/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_item/bt/revision [utf8] Mon Nov 29 19:01:50 2010
@@ -1 +1 @@
-229
\ No newline at end of file
+231
\ No newline at end of file




More information about the Erp5-report mailing list