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 @@
request = context.REQUEST\n
translateString = context.Base_translateString \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
if field_my_shipping_method is 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
field_my_payment_mode = context.REQUEST.get("field_my_payment_mode", None) \n
\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
shopping_cart = context.SaleOrder_getShoppingCart()\n
shopping_cart_product_item_list = context.SaleOrder_getShoppingCartItemList()\n
\n
# Handle change in quantity for shopping items\n
if quantity is not None:\n
......@@ -223,7 +221,7 @@ if quantity is not None:\n
quantity = [quantity]\n
\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
if new_quantity>=1:\n
order_line.setQuantity(new_quantity)\n
......@@ -233,23 +231,24 @@ if quantity is not None:\n
counter += 1\n
\n
# Handle shipping\n
order_line = getattr(shopping_cart, \'shipping_method\', None)\n
if shipping_method not in [\'\', None]:\n
shipping = context.getPortalObject().restrictedTraverse(shipping_method)\n
if order_line is not None:\n
shopping_cart.manage_delObjects(order_line.getId())\n
if field_my_shipping_method not in [\'\', None]:\n
line = getattr(shopping_cart, \'shipping_method\', None)\n
if line is not None:\n
shopping_cart.manage_delObjects(line.getId())\n
shipping = context.getPortalObject().restrictedTraverse(field_my_shipping_method)\n
# create new shipping method order line\n
order_line = shopping_cart.newContent(id=\'shipping_method\', portal_type=\'Sale Order Line\')\n
# .. and update it\n
order_line.setResource(shipping.getRelativeUrl())\n
order_line.setQuantity(1)\n
shopping_cart.newContent(\n
id=\'shipping_method\', \n
portal_type=\'Sale Order Line\', \n
resource_value=shipping, \n
quantity=1)\n
\n
# Handle payment mode and comment\n
if field_my_comment is not None:\n
shopping_cart.setComment(field_my_comment)\n
\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
if redirect:\n
# Hardcode redirection.\n
......@@ -274,7 +273,7 @@ if redirect:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_editShoppingCart</string> </value>
<value> <string>WebSection_editShoppingCart</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -225,7 +225,7 @@ sale_order = module.newContent(portal_type=portal_type,\n
# set order default currency,\n
default_price_currency = web_site.WebSite_getShoppingCartDefaultCurrency().getRelativeUrl(),\n
# set trade condition\n
specialise_value = web_site.SaleOrder_getDefaultTradeCondition()\n
specialise = shopping_cart.getSpecialise()\n
)\n
\n
for order_line in shopping_cart_item_list:\n
......
......@@ -61,7 +61,7 @@ isAnon = context.portal_membership.isAnonymousUser()\n
translateString = context.Base_translateString\n
\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
shopping_cart = context.SaleOrder_getShoppingCart()\n
field_my_comment = shopping_cart.getComment()\n
......@@ -73,7 +73,7 @@ if isAnon:\n
msg = translateString("You need to login or create an account to continue.")\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
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
keep_items={\'portal_status_message\': msg,\n
\'came_from\': coming_from_url})\n
......@@ -107,7 +107,7 @@ context.Base_redirect(\'WebSection_viewShoppingCart\', \\\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_paymentRedirect</string> </value>
<value> <string>WebSection_paymentRedirect</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>SaleOrder_editShoppingCart</string> </value>
<value> <string>WebSection_editShoppingCart</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -139,7 +139,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Product_view</string> </value>
<value> <string>WebSection_viewShoppingCart</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -134,26 +134,20 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<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>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
......@@ -166,10 +160,7 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
......
......@@ -164,7 +164,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SaleOrder_paymentRedirect:method</string> </value>
<value> <string>WebSection_paymentRedirect:method</string> </value>
</item>
<item>
<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