Commit 1c58d2f7 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_advanced_ecommerce: add tax

parent c6344595
total_discount = context.SaleOrder_getTotalDiscount()
total_tax = context.SaleOrder_getTotalTax()
return context.getTotalPrice() + total_discount
return context.getTotalPrice() + total_discount + total_tax
......@@ -17,7 +17,7 @@ if sale_order is None:
if discount:
total = sale_order.SaleOrder_getFinalPrice()
else:
total = sale_order.getTotalPrice()
total = sale_order.getTotalPrice() + sale_order.SaleOrder_getTotalTax()
if not include_shipping:
shipping_method = getattr(sale_order, 'shipping_method', None)
......
return round(sum([i.getTotalPrice() for i in context.getAggregatedAmountList(rounding=True)
if "base_amount/trade/base/taxable/vat/vat_normal_rate" in i.getBaseApplicationList()]), 2)
<?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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_getTotalTax</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -4,6 +4,7 @@
shopping_cart_item_list shopping_cart/SaleOrder_getShoppingCartItemList;
shipping here/SaleOrder_getSelectedShippingResource;
discount shopping_cart/SaleOrder_getTotalDiscount;
total_tax python: shopping_cart.SaleOrder_getTotalTax();
total_price python: shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_currency=False);">
<div class="shopping_cart_item_list">
......@@ -64,6 +65,10 @@
</div>
<div class="shopping_cart_end_lines">
<table cellpadding="0" cellspacing="0">
<tr>
<td><span tal:replace="python: here.Base_translateString('Tax')"/></td>
<td> <span tal:replace="python: '%s %s' % (total_tax, currency_code)"/> </td>
</tr>
<tr>
<td><span tal:replace="python: here.Base_translateString('Sub Total')"/></td>
<td> <span tal:replace="python: '%s %s' % (total_price, currency_code)"/> </td>
......
......@@ -7,6 +7,7 @@
discount shopping_cart/SaleOrder_getTotalDiscount;
currency web_site/WebSite_getShoppingCartDefaultCurrency;
currency_symbol python: context.getPortalObject().restrictedTraverse(shopping_cart.getPriceCurrency()).getShortTitle();
total_tax python: shopping_cart.SaleOrder_getTotalTax();
total_price python: here.SaleOrder_getShoppingCartTotalPrice(include_currency=True, discount=True);">
<tr tal:repeat="order_line shopping_cart_item_list">
......@@ -58,6 +59,17 @@
</td></tr>
</tal:block>
<tal:block tal:condition = "python: not empty_cart and total_tax > 0">
<tr><td class="cart_middle">
<div class="cart_left">
<span tal:replace="python: here.Base_translateString('Tax')"/>
</div>
<div class="cart_right">
<span tal:replace="total_tax"/> <span tal:replace="currency_symbol"/>
</div>
</td></tr>
</tal:block>
<tal:block tal:condition = "not: empty_cart">
<tr><td class="cart_middle">
<div class="cart_left">
......
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