[Erp5-report] r42514 romain - in /erp5/trunk/bt5/vifib_web: SkinTemplateItem/portal_skins/v...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 20 15:04:40 CET 2011


Author: romain
Date: Thu Jan 20 15:04:40 2011
New Revision: 42514

URL: http://svn.erp5.org?rev=42514&view=rev
Log:
Explicitely generate Purchase Packing List parameter.

Modified:
    erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_addSelectedSoftwareProductToInstallationShoppingCart.xml
    erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_requestSoftwareReleaseInstallation.xml
    erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_triggerSelectedSoftwareReleaseInstallation.xml
    erp5/trunk/bt5/vifib_web/bt/revision

Modified: erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_addSelectedSoftwareProductToInstallationShoppingCart.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_addSelectedSoftwareProductToInstallationShoppingCart.xml?rev=42514&r1=42513&r2=42514&view=diff
==============================================================================
--- erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_addSelectedSoftwareProductToInstallationShoppingCart.xml [utf8] (original)
+++ erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_addSelectedSoftwareProductToInstallationShoppingCart.xml [utf8] Thu Jan 20 15:04:40 2011
@@ -52,36 +52,13 @@
             <key> <string>_body</string> </key>
             <value> <string>"""Add selected product to the cart and continue"""\n
 portal = context.getPortalObject()\n
-prefered_resource = portal.portal_preferences.getPreferredInstanceSetupResource()\n
-service = portal.restrictedTraverse(prefered_resource)\n
 \n
-##Get item list\n
-item_list = []\n
-if uids:\n
-  item_list = [item.getObject() for item in portal.portal_catalog(uid=uids, portal_type="Software Product")]\n
-\n
-if len(item_list) != 1:\n
+if len(uids) != 1:\n
   return context.Base_redirect(dialog_id,\n
                         keep_items={\'portal_status_message\':context.Base_translateString("Please select one service.")})\n
-\n
-\n
-shopping_cart = context.SaleOrder_getShoppingCart()\n
-shopping_cart_items = context.SaleOrder_getShoppingCartItemList()\n
-\n
-item = item_list[0]\n
-\n
-if len(shopping_cart_items) != 1:\n
-  raise NotImplementedError, "There should be only one shopping card item."\n
-\n
-product_url = item.getRelativeUrl()\n
-\n
-order_line = shopping_cart_items[0]\n
-order_line.edit(\n
-  aggregate_list=order_line.getAggregateList() + [product_url],\n
-)\n
-\n
-##Set connected member as shopping cart customer\n
-context.SaleOrder_setShoppingCartCustomer()\n
+else:\n
+  session = context.WebSection_getVifibSession()\n
+  session[\'instance_software_product_uid\'] = uids[0]\n
 \n
 if kw.has_key(\'came_from\'):\n
   #we override the context to redirect the user to the next web section\n
@@ -131,19 +108,10 @@ context.WebSection_viewNextStep()\n
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>portal</string>
-                            <string>prefered_resource</string>
-                            <string>service</string>
-                            <string>item_list</string>
-                            <string>$list0</string>
-                            <string>_getiter_</string>
-                            <string>item</string>
                             <string>len</string>
-                            <string>shopping_cart</string>
-                            <string>shopping_cart_items</string>
+                            <string>session</string>
                             <string>_getitem_</string>
-                            <string>NotImplementedError</string>
-                            <string>product_url</string>
-                            <string>order_line</string>
+                            <string>_write_</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_requestSoftwareReleaseInstallation.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_requestSoftwareReleaseInstallation.xml?rev=42514&r1=42513&r2=42514&view=diff
==============================================================================
--- erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_requestSoftwareReleaseInstallation.xml [utf8] (original)
+++ erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_requestSoftwareReleaseInstallation.xml [utf8] Thu Jan 20 15:04:40 2011
@@ -59,21 +59,8 @@ service = portal.restrictedTraverse(pref
 if context.getPortalType() != "Computer":\n
   raise NotImplementedError, "Should be called on a Computer"\n
 \n
-##Reset the cart and get new shopping cart\n
-if reset_shopping_cart:\n
-  context.SaleOrder_getShoppingCart(action=\'reset\')\n
-\n
-shopping_cart = context.SaleOrder_getShoppingCart()\n
-\n
-## new Resource so add it to shopping cart\n
-order_line = shopping_cart.newContent(portal_type=\'Sale Order Line\',\n
-                                      quantity=1,\n
-                                      resource=prefered_resource,\n
-                                      price=50,\n
-                                      aggregate_list=[context.getRelativeUrl()])\n
-    \n
-##Set connected member as shopping cart customer\n
-context.SaleOrder_setShoppingCartCustomer()\n
+session = context.WebSection_getVifibSession()\n
+session[\'computer_uid\'] = context.getUid()\n
 \n
 web_section = context.getWebSectionValue()\n
 return web_section.Base_redirect(\'install-a-software\', keep_items={\'editable_mode\': 0})\n
@@ -124,8 +111,8 @@ return web_section.Base_redirect(\'insta
                             <string>prefered_resource</string>
                             <string>service</string>
                             <string>NotImplementedError</string>
-                            <string>shopping_cart</string>
-                            <string>order_line</string>
+                            <string>session</string>
+                            <string>_write_</string>
                             <string>web_section</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_triggerSelectedSoftwareReleaseInstallation.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_triggerSelectedSoftwareReleaseInstallation.xml?rev=42514&r1=42513&r2=42514&view=diff
==============================================================================
--- erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_triggerSelectedSoftwareReleaseInstallation.xml [utf8] (original)
+++ erp5/trunk/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_triggerSelectedSoftwareReleaseInstallation.xml [utf8] Thu Jan 20 15:04:40 2011
@@ -52,9 +52,11 @@
             <key> <string>_body</string> </key>
             <value> <string>"""Add selected product to the cart and continue"""\n
 portal = context.getPortalObject()\n
-prefered_resource = portal.portal_preferences.getPreferredInstanceSetupResource()\n
+prefered_resource = portal.portal_preferences.getPreferredSoftwareSetupResource()\n
 service = portal.restrictedTraverse(prefered_resource)\n
 \n
+session = context.WebSection_getVifibSession()\n
+\n
 ##Get item list\n
 item_list = []\n
 if uids:\n
@@ -64,43 +66,46 @@ if len(item_list) != 1:\n
   return context.Base_redirect(dialog_id,\n
                         keep_items={\'portal_status_message\':context.Base_translateString("Please select one software release.")})\n
 \n
-shopping_cart = context.SaleOrder_getShoppingCart()\n
-shopping_cart_items = context.SaleOrder_getShoppingCartItemList()\n
+item = item_list[0]\n
+# XXX Check that release is associate to product\n
 \n
-# Assert that there is only one shopping cart items\n
-if len(shopping_cart_items) != 1:\n
-  raise NotImplementedError, "There should be only one shopping cart item."\n
+computer = portal.portal_catalog.getResultValue(\n
+  uid=session[\'computer_uid\'],\n
+  portal_type="Computer",\n
+)\n
 \n
-item = item_list[0]\n
-product_url = item.getAggregate()\n
-## check if we don\'t have already such a resource in cart\n
-line_found=False\n
-for order_line in shopping_cart_items:\n
-  if product_url in order_line.getAggregateList():\n
-    line_found=True\n
-    order_line.edit(aggregate_value_list=order_line.getAggregateList() + [item.getRelativeUrl()])\n
-    break\n
-\n
-if not line_found:\n
-  raise NotImplementedError, "No shopping cart item related to the release found."\n
-    \n
-##Set connected member as shopping cart customer\n
-context.SaleOrder_setShoppingCartCustomer()\n
+# XXX Hardcoded values\n
+seller = portal.restrictedTraverse("organisation_module/vifib_internet")\n
+currency = portal.restrictedTraverse("currency_module/EUR")\n
+person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
 \n
 packing_list_portal_type = "Purchase Packing List"\n
 module = portal.getDefaultModule(portal_type=packing_list_portal_type)\n
 packing_list = module.newContent(\n
   portal_type=packing_list_portal_type,\n
   start_date=DateTime(),\n
+  destination_section_value=person,\n
+  destination_decision_value=person,\n
+  source_administration_value=person,\n
+  # XXX Hardcoded values\n
+  source_value=seller,\n
+  source_section_value=seller,\n
+  price_currency_value=currency,\n
 )\n
 packing_list.newContent(\n
   portal_type="Purchase Packing List Line",\n
-  resource_value=order_line.getResourceValue(),\n
-  aggregate_value_list=order_line.getAggregateValueList(),\n
-  quantity=order_line.getQuantity()\n
+  resource_value=service,\n
+  aggregate_value_list=[item, computer],\n
+  quantity=1\n
 )\n
-packing_list.confirm()\n
-context.SaleOrder_getShoppingCart(action=\'reset\')\n
+\n
+portal.portal_workflow.doActionFor(packing_list, "confirm_action")\n
+# packing_list.confirm()\n
+\n
+session[\'instance_software_product_uid\'] = ""\n
+session[\'instance_software_release_uid\'] = ""\n
+session[\'computer_uid\'] = ""\n
+\n
 web_section = context.getWebSiteValue()\n
 return web_section.Base_redirect(keep_items={\'editable_mode\': 0})\n
 </string> </value>
@@ -148,24 +153,22 @@ return web_section.Base_redirect(keep_it
                             <string>portal</string>
                             <string>prefered_resource</string>
                             <string>service</string>
+                            <string>session</string>
                             <string>item_list</string>
                             <string>$list0</string>
                             <string>_getiter_</string>
                             <string>item</string>
                             <string>len</string>
-                            <string>shopping_cart</string>
-                            <string>shopping_cart_items</string>
-                            <string>NotImplementedError</string>
                             <string>_getitem_</string>
-                            <string>product_url</string>
-                            <string>False</string>
-                            <string>line_found</string>
-                            <string>order_line</string>
-                            <string>True</string>
+                            <string>computer</string>
+                            <string>seller</string>
+                            <string>currency</string>
+                            <string>person</string>
                             <string>packing_list_portal_type</string>
                             <string>module</string>
                             <string>DateTime</string>
                             <string>packing_list</string>
+                            <string>_write_</string>
                             <string>web_section</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/bt5/vifib_web/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/vifib_web/bt/revision?rev=42514&r1=42513&r2=42514&view=diff
==============================================================================
--- erp5/trunk/bt5/vifib_web/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/vifib_web/bt/revision [utf8] Thu Jan 20 15:04:40 2011
@@ -1 +1 @@
-260
\ No newline at end of file
+264
\ No newline at end of file



More information about the Erp5-report mailing list