Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
e6a320da
Commit
e6a320da
authored
Aug 27, 2012
by
Jean-Paul Smets
Committed by
Xiaowu Zhang
Feb 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle payment mode and comments through accessors
Also improved comments and docstring including TODO.
parent
ed22430e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/SaleOrder_editShoppingCart.xml
...portal_skins/erp5_commerce/SaleOrder_editShoppingCart.xml
+17
-9
No files found.
bt5/erp5_commerce/SkinTemplateItem/portal_skins/erp5_commerce/SaleOrder_editShoppingCart.xml
View file @
e6a320da
...
...
@@ -189,10 +189,14 @@
<value>
<string
encoding=
"cdata"
>
<![CDATA[
"""\n
Update shopping cart by change items quantity and setting preferred \n
shipping.\n
"""\n
Update shopping cart by changing item quantities and by setting preferred\n
shipping method and payment method.\n
\n
TODO:\n
- support modern payment conditions (instead of payment_mode)\n
- use Base_edit and a real ERP5 Form in order to benefit from\n
field reusability and property validation\n
"""\n
request = context.REQUEST\n
translateString = context.Base_translateString \n
quantity = field_my_buy_quantity\n
...
...
@@ -201,10 +205,10 @@ shopping_cart_items = context.SaleOrder_getShoppingCartItemList(include_shipping
shopping_cart_products_items = filter(lambda x: x.getId()!=\'shipping_method\', shopping_cart_items)\n
shopping_cart = context.SaleOrder_getShoppingCart()\n
\n
#
h
andle change in quantity for shopping items\n
#
H
andle change in quantity for shopping items\n
if quantity is not None:\n
#
when we have one item in shoppping cart we get
\n
#
quantity a
s a string rather as a list\n
#
Whenever there is onlu one item in shoppping cart, quantity
\n
#
i
s a string rather as a list\n
if isinstance(quantity, str):\n
quantity = [quantity]\n
\n
...
...
@@ -214,11 +218,11 @@ if quantity is not None:\n
if new_quantity>
=1:\n
order_line.setQuantity(new_quantity)\n
else:\n
#
r
emove it from shopping cart\n
#
R
emove it from shopping cart\n
shopping_cart.manage_delObjects(order_line.getId())\n
counter += 1\n
\n
#
h
andle shipping\n
#
H
andle 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
...
...
@@ -232,7 +236,11 @@ else:\n
if field_my_shipping_method in [\'\', None] and order_line is not None:\n
shopping_cart.manage_delObjects(order_line.getId())\n
\n
return context.SaleOrder_paymentRedirect(field_my_comment, field_my_payment_mode)\n
# Handle payment mode and comment\n
shopping_cart.setComment(field_my_comment)\n
shopping_cart.setPaymentConditionPaymentMode(field_my_payment_mode) # XXX This is bad because it does not use trade conditions XXX\n
\n
return context.SaleOrder_paymentRedirect()\n
]]>
</string>
</value>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment