Commit 0f1b8ec8 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

call expensive newTempSimulationMovement only if it is required.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35991 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 263d904d
......@@ -218,10 +218,7 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
return 1
def _getCurrencyRatioAndPrecisionByArrow(self, arrow, prevision_line):
from Products.ERP5Type.Document import newTempSimulationMovement
prevision_currency = prevision_line.get('resource', None)
temporary_movement = newTempSimulationMovement(self.getPortalObject(),
'1', **prevision_line)
exchange_ratio = None
precision = None
section = prevision_line.get(arrow, None)
......@@ -231,6 +228,9 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
else:
currency_url = None
if currency_url is not None and prevision_currency != currency_url:
from Products.ERP5Type.Document import newTempSimulationMovement
temporary_movement = newTempSimulationMovement(self.getPortalObject(),
'1', **prevision_line)
precision = section.getPriceCurrencyValue() \
.getQuantityPrecision()
exchange_ratio = self.restrictedTraverse(currency_url).getPrice(
......
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