Commit 7f82568d authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Xiaowu Zhang

erp5_commerce_related

parent 4e38aa86
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</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>"""\n
Return the default trade condition for thie ecommerce site\n
\n
TODO:\n
- (rafael) This script should be removed or turned into a preference at least.\n
\n
"""\n
default = "sale_trade_condition_module/default_trade_condition"\n
\n
website = context.getWebSiteValue()\n
if website:\n
default = website.getLayoutProperty(\'ecommerce_default_trade_condition\', default)\n
\n
return context.getPortalObject().restrictedTraverse(default)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_getDefaultTradeCondition</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>DEPRECATED</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
request = context.REQUEST\n request = context.REQUEST\n
translateString = context.Base_translateString \n translateString = context.Base_translateString \n
if field_my_buy_quantity is None:\n if field_my_buy_quantity is None:\n
field_my_buy_quantity=context.REQUEST.get("field_my_buy_quantity", None)\n field_my_buy_quantity = context.REQUEST.get("field_my_buy_quantity", None)\n
\n \n
if field_my_shipping_method is None:\n if field_my_shipping_method is None:\n
field_my_shipping_method=context.REQUEST.get("field_my_shipping_method", None) \n field_my_shipping_method=context.REQUEST.get("field_my_shipping_method", None) \n
...@@ -209,11 +209,9 @@ if field_my_payment_mode is None:\n ...@@ -209,11 +209,9 @@ if field_my_payment_mode is None:\n
field_my_payment_mode = context.REQUEST.get("field_my_payment_mode", None) \n field_my_payment_mode = context.REQUEST.get("field_my_payment_mode", None) \n
\n \n
quantity = field_my_buy_quantity\n quantity = field_my_buy_quantity\n
shipping_method = field_my_shipping_method\n
shopping_cart_items = context.SaleOrder_getShoppingCartItemList(include_shipping=True)\n
shopping_cart_products_items = filter(lambda x: x.getId()!=\'shipping_method\', shopping_cart_items)\n
shopping_cart = context.SaleOrder_getShoppingCart()\n
\n \n
shopping_cart = context.SaleOrder_getShoppingCart()\n
shopping_cart_product_item_list = context.SaleOrder_getShoppingCartItemList()\n
\n \n
# Handle change in quantity for shopping items\n # Handle change in quantity for shopping items\n
if quantity is not None:\n if quantity is not None:\n
...@@ -223,7 +221,7 @@ if quantity is not None:\n ...@@ -223,7 +221,7 @@ if quantity is not None:\n
quantity = [quantity]\n quantity = [quantity]\n
\n \n
counter = 0\n counter = 0\n
for order_line in shopping_cart_products_items:\n for order_line in shopping_cart_product_item_list:\n
new_quantity = int(quantity[counter])\n new_quantity = int(quantity[counter])\n
if new_quantity>=1:\n if new_quantity>=1:\n
order_line.setQuantity(new_quantity)\n order_line.setQuantity(new_quantity)\n
...@@ -233,23 +231,24 @@ if quantity is not None:\n ...@@ -233,23 +231,24 @@ if quantity is not None:\n
counter += 1\n counter += 1\n
\n \n
# Handle shipping\n # Handle shipping\n
order_line = getattr(shopping_cart, \'shipping_method\', None)\n if field_my_shipping_method not in [\'\', None]:\n
if shipping_method not in [\'\', None]:\n line = getattr(shopping_cart, \'shipping_method\', None)\n
shipping = context.getPortalObject().restrictedTraverse(shipping_method)\n if line is not None:\n
if order_line is not None:\n shopping_cart.manage_delObjects(line.getId())\n
shopping_cart.manage_delObjects(order_line.getId())\n shipping = context.getPortalObject().restrictedTraverse(field_my_shipping_method)\n
# create new shipping method order line\n # create new shipping method order line\n
order_line = shopping_cart.newContent(id=\'shipping_method\', portal_type=\'Sale Order Line\')\n shopping_cart.newContent(\n
# .. and update it\n id=\'shipping_method\', \n
order_line.setResource(shipping.getRelativeUrl())\n portal_type=\'Sale Order Line\', \n
order_line.setQuantity(1)\n resource_value=shipping, \n
quantity=1)\n
\n \n
# Handle payment mode and comment\n # Handle payment mode and comment\n
if field_my_comment is not None:\n if field_my_comment is not None:\n
shopping_cart.setComment(field_my_comment)\n shopping_cart.setComment(field_my_comment)\n
\n \n
if field_my_payment_mode is not None:\n if field_my_payment_mode is not None:\n
shopping_cart.setPaymentConditionPaymentMode(field_my_payment_mode) # XXX This is bad because it does not use trade conditions XXX\n shopping_cart.setPaymentConditionPaymentMode(field_my_payment_mode)\n
\n \n
if redirect:\n if redirect:\n
# Hardcode redirection.\n # Hardcode redirection.\n
...@@ -274,7 +273,7 @@ if redirect:\n ...@@ -274,7 +273,7 @@ if redirect:\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SaleOrder_editShoppingCart</string> </value> <value> <string>WebSection_editShoppingCart</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -225,7 +225,7 @@ sale_order = module.newContent(portal_type=portal_type,\n ...@@ -225,7 +225,7 @@ sale_order = module.newContent(portal_type=portal_type,\n
# set order default currency,\n # set order default currency,\n
default_price_currency = web_site.WebSite_getShoppingCartDefaultCurrency().getRelativeUrl(),\n default_price_currency = web_site.WebSite_getShoppingCartDefaultCurrency().getRelativeUrl(),\n
# set trade condition\n # set trade condition\n
specialise_value = web_site.SaleOrder_getDefaultTradeCondition()\n specialise = shopping_cart.getSpecialise()\n
)\n )\n
\n \n
for order_line in shopping_cart_item_list:\n for order_line in shopping_cart_item_list:\n
......
...@@ -61,7 +61,7 @@ isAnon = context.portal_membership.isAnonymousUser()\n ...@@ -61,7 +61,7 @@ isAnon = context.portal_membership.isAnonymousUser()\n
translateString = context.Base_translateString\n translateString = context.Base_translateString\n
\n \n
# Make sure we save shopping cart informations modified on last minute.\n # Make sure we save shopping cart informations modified on last minute.\n
context.SaleOrder_editShoppingCart(redirect=False, **kw)\n context.WebSection_editShoppingCart(redirect=False, **kw)\n
\n \n
shopping_cart = context.SaleOrder_getShoppingCart()\n shopping_cart = context.SaleOrder_getShoppingCart()\n
field_my_comment = shopping_cart.getComment()\n field_my_comment = shopping_cart.getComment()\n
...@@ -73,7 +73,7 @@ if isAnon:\n ...@@ -73,7 +73,7 @@ if isAnon:\n
msg = translateString("You need to login or create an account to continue.")\n msg = translateString("You need to login or create an account to continue.")\n
from ZTUtils import make_query\n from ZTUtils import make_query\n
parameter_string = make_query(field_my_comment=field_my_comment, field_my_payment_mode=field_my_payment_mode)\n parameter_string = make_query(field_my_comment=field_my_comment, field_my_payment_mode=field_my_payment_mode)\n
coming_from_url = \'%s/SaleOrder_paymentRedirect?%s\' % (context.absolute_url(), parameter_string)\n coming_from_url = \'%s/WebSection_paymentRedirect?%s\' % (context.absolute_url(), parameter_string)\n
return web_site.Base_redirect(\'login_form\', \\\n return web_site.Base_redirect(\'login_form\', \\\n
keep_items={\'portal_status_message\': msg,\n keep_items={\'portal_status_message\': msg,\n
\'came_from\': coming_from_url})\n \'came_from\': coming_from_url})\n
...@@ -107,7 +107,7 @@ context.Base_redirect(\'WebSection_viewShoppingCart\', \\\n ...@@ -107,7 +107,7 @@ context.Base_redirect(\'WebSection_viewShoppingCart\', \\\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SaleOrder_paymentRedirect</string> </value> <value> <string>WebSection_paymentRedirect</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</item> </item>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>SaleOrder_editShoppingCart</string> </value> <value> <string>WebSection_editShoppingCart</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
</item> </item>
<item> <item>
<key> <string>name</string> </key> <key> <string>name</string> </key>
<value> <string>Product_view</string> </value> <value> <string>WebSection_viewShoppingCart</string> </value>
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
......
...@@ -134,26 +134,20 @@ ...@@ -134,26 +134,20 @@
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <global name="TALESMethod" module="Products.Formulator.TALESField"/>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.getWebSiteValue().SaleOrder_getShoppingCart().getPaymentConditionPaymentMode()</string> </value> <value> <string>python: here.SaleOrder_getShoppingCart().getPaymentConditionPaymentMode()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<tuple> <global name="TALESMethod" module="Products.Formulator.TALESField"/>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -166,10 +160,7 @@ ...@@ -166,10 +160,7 @@
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<tuple> <global name="TALESMethod" module="Products.Formulator.TALESField"/>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
</item> </item>
<item> <item>
<key> <string>name</string> </key> <key> <string>name</string> </key>
<value> <string>SaleOrder_paymentRedirect:method</string> </value> <value> <string>WebSection_paymentRedirect:method</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment