Commit c18e4545 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

create a temporary simulation only if it is needed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31896 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 690d4833
......@@ -236,8 +236,6 @@ class InvoiceTransactionRuleMovementGenerator(object):
prevision_currency = prevision_line['resource'][0]
except IndexError:
prevision_currency = None
temporary_movement = newTempSimulationMovement(rule.getPortalObject(),
'1', **prevision_line)
exchange_ratio = None
precision = None
try:
......@@ -252,6 +250,8 @@ class InvoiceTransactionRuleMovementGenerator(object):
if currency_url is not None and prevision_currency != currency_url:
precision = section.getPriceCurrencyValue() \
.getQuantityPrecision()
temporary_movement = newTempSimulationMovement(rule.getPortalObject(),
'1', **prevision_line)
exchange_ratio = rule.restrictedTraverse(currency_url).getPrice(
context=temporary_movement.asContext(
categories=['price_currency/%s' % currency_url,
......
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