Commit 681985ad authored by Jérome Perrin's avatar Jérome Perrin

support tax line with multiple base applications and multiple delivery lines



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20516 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8cbc2ba4
...@@ -89,14 +89,15 @@ other_movement_list = [m for m in context.getExplanationValue().getMovementList( ...@@ -89,14 +89,15 @@ other_movement_list = [m for m in context.getExplanationValue().getMovementList(
portal_type=context.getPortalMovementTypeList())]\n portal_type=context.getPortalMovementTypeList())]\n
# 2 for each tax line, calculate the corresponding ratio\n # 2 for each tax line, calculate the corresponding ratio\n
for tax_line in contributed_tax_line_list:\n for tax_line in contributed_tax_line_list:\n
# XXX only the first one is used here !\n
# this assume that a tax will be applied to only one base_amount\n
base_amount = tax_line.getBaseApplication()\n
base_total_price = 0\n base_total_price = 0\n
added_movement_list = {}\n
for base_amount in tax_line.getBaseApplicationList():\n
for movement in other_movement_list:\n for movement in other_movement_list:\n
if base_amount in movement.getBaseContributionList():\n if base_amount in movement.getBaseContributionList():\n
if movement.getRelativeUrl() not in added_movement_list:\n
base_total_price += movement.getTotalPrice(fast=0)\n base_total_price += movement.getTotalPrice(fast=0)\n
\n added_movement_list[movement.getRelativeUrl()] = 1\n
\n
adjusted_tax_line_list.append(tax_line.asContext(quantity=\n adjusted_tax_line_list.append(tax_line.asContext(quantity=\n
# XXX round ?\n # XXX round ?\n
tax_line.getQuantity() * total_price / base_total_price))\n tax_line.getQuantity() * total_price / base_total_price))\n
...@@ -164,8 +165,10 @@ return adjusted_tax_line_list\n ...@@ -164,8 +165,10 @@ return adjusted_tax_line_list\n
<string>m</string> <string>m</string>
<string>other_movement_list</string> <string>other_movement_list</string>
<string>base_total_price</string> <string>base_total_price</string>
<string>added_movement_list</string>
<string>movement</string> <string>movement</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
<string>_write_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
265 266
\ No newline at end of file \ No newline at end of file
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