Commit 39bc3ce1 authored by Jérome Perrin's avatar Jérome Perrin

don't initialize tax lines when applying trade condition

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28510 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6f2507a0
...@@ -104,77 +104,6 @@ if force:\n ...@@ -104,77 +104,6 @@ if force:\n
if len(order.contentIds(filter=filter_dict)) == 0:\n if len(order.contentIds(filter=filter_dict)) == 0:\n
copyPaymentCondition(order, trade_condition)\n copyPaymentCondition(order, trade_condition)\n
\n \n
# initialise discount lines\n
def initialiseDiscountLineList(order, trade_condition):\n
for discount_model_line in trade_condition.contentValues(\n
portal_type=\'Discount Model Line\'):\n
discount_model_line_reference = discount_model_line.getReference()\n
if not discount_model_line_reference or discount_model_line_reference not in [\n
x.getProperty(\'reference\') for x in\n
order.contentValues(portal_type=\'Discount Line\')]:\n
discount_line = order.newContent(\n
portal_type=\'Discount Line\',\n
resource=discount_model_line.getResource(),\n
reference=discount_model_line_reference,\n
float_index=discount_model_line.getFloatIndex(),\n
base_application_list=discount_model_line.getBaseApplicationList(),\n
base_contribution_list=discount_model_line.getBaseContributionList(),\n
quantity=0,\n
price=0,)\n
# calculation_script\n
if discount_model_line.getProperty(\'calculation_script_id\'):\n
raise NotImplementedError\n
# fixed_amount\n
if discount_model_line.getQuantity():\n
raise NotImplementedError\n
# ratio\n
discount_line.setPrice(discount_model_line.getEfficiency())\n
\n
# recurse on other trade conditions\n
for specialised_trade_condition in trade_condition.getSpecialiseValueList():\n
initialiseDiscountLineList(order, specialised_trade_condition)\n
\n
\n
# initialise tax lines\n
def initialiseTaxLineList(order, trade_condition):\n
for tax_model_line in trade_condition.contentValues(portal_type=\'Tax Model Line\'):\n
tax_model_line_reference = tax_model_line.getReference()\n
if not tax_model_line_reference or tax_model_line_reference not in [\n
x.getProperty(\'reference\') for x in\n
order.contentValues(portal_type=\'Tax Line\')]:\n
tax_line = order.newContent(\n
portal_type=\'Tax Line\',\n
resource=tax_model_line.getResource(),\n
reference=tax_model_line_reference,\n
float_index=tax_model_line.getFloatIndex(),\n
base_application_list=tax_model_line.getBaseApplicationList(),\n
base_contribution_list=tax_model_line.getBaseContributionList(),\n
quantity=0,\n
price=0,)\n
# calculation_script\n
if tax_model_line.getProperty(\'calculation_script_id\'):\n
raise NotImplementedError\n
# fixed_amount\n
if tax_model_line.getQuantity():\n
raise NotImplementedError\n
# ratio\n
tax_line.setPrice(tax_model_line.getEfficiency())\n
\n
# recurse on other trade conditions\n
for specialised_trade_condition in trade_condition.getSpecialiseValueList():\n
initialiseTaxLineList(order, specialised_trade_condition)\n
if force:\n
context.manage_delObjects([x.getId() for x in context.contentValues(\n
portal_type=(\'Discount Line\', \'Tax Line\'))])\n
\n
if not len(context.contentValues(portal_type=(\'Discount Line\', \'Tax Line\'))):\n
initialiseTaxLineList(context, trade_condition)\n
initialiseDiscountLineList(context, trade_condition)\n
\n
# if the order already contain lines, immediately update tax line\n
if order.getMovementList():\n
order.Delivery_updateTaxLineList()\n
\n
# set specialise\n # set specialise\n
new_category_dict[\'specialise\'] = trade_condition.getRelativeUrl()\n new_category_dict[\'specialise\'] = trade_condition.getRelativeUrl()\n
\n \n
...@@ -233,11 +162,6 @@ order.edit(**new_category_dict)\n ...@@ -233,11 +162,6 @@ order.edit(**new_category_dict)\n
<string>filter_dict</string> <string>filter_dict</string>
<string>list</string> <string>list</string>
<string>len</string> <string>len</string>
<string>initialiseDiscountLineList</string>
<string>initialiseTaxLineList</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>_apply_</string> <string>_apply_</string>
</tuple> </tuple>
</value> </value>
......
720 721
\ 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