Commit 3f74f375 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

try to find portal_roundings.getRoundingProxy only if it is required.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35997 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1e482db2
...@@ -171,12 +171,11 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -171,12 +171,11 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
base_id='movement', rounding=False, **kw): base_id='movement', rounding=False, **kw):
from Products.ERP5Type.Document import newTempSimulationMovement from Products.ERP5Type.Document import newTempSimulationMovement
# Define rounding stuff
portal_roundings = getToolByName(self, 'portal_roundings', None)
# ROUNDING # ROUNDING
if rounding: if rounding:
movement_list = [portal_roundings.getRoundingProxy(movement, context=self) rounding_proxy = getToolByName(self.getPortalObject(),
'portal_roundings').getRoundingProxy
movement_list = [rounding_proxy(movement, context=self)
for movement in movement_list] for movement in movement_list]
aggregated_amount_list = AggregatedAmountList() aggregated_amount_list = AggregatedAmountList()
...@@ -279,7 +278,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -279,7 +278,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
# tmp_movement.getTotalPrice() returns rounded result. # tmp_movement.getTotalPrice() returns rounded result.
# If rounded_property_id='quantity', then # If rounded_property_id='quantity', then
# tmp_movement.getQuantity() will be rounded. # tmp_movement.getQuantity() will be rounded.
tmp_movement = portal_roundings.getRoundingProxy(tmp_movement, context=self) tmp_movement = rounding_proxy(tmp_movement, context=self)
tmp_movement.edit( tmp_movement.edit(
variation_base_category_list = cell.getVariationBaseCategoryList(), variation_base_category_list = cell.getVariationBaseCategoryList(),
variation_category_list = cell.getVariationCategoryList(), variation_category_list = cell.getVariationCategoryList(),
...@@ -300,7 +299,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -300,7 +299,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
if rounding: if rounding:
# Replace temporary movement with rounding proxy so that target # Replace temporary movement with rounding proxy so that target
# property value will be rounded. # property value will be rounded.
tmp_movement = portal_roundings.getRoundingProxy(tmp_movement, context=self) tmp_movement = rounding_proxy(tmp_movement, context=self)
tmp_movement_list.append(tmp_movement) tmp_movement_list.append(tmp_movement)
modified = 0 modified = 0
aggregated_movement_list = [] aggregated_movement_list = []
...@@ -363,7 +362,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -363,7 +362,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
# Do nothing # Do nothing
return aggregated_amount_list return aggregated_amount_list
if rounding: if rounding:
tmp_movement = portal_roundings.getRoundingProxy( tmp_movement = rounding_proxy(
tmp_movement, context=self) tmp_movement, context=self)
# check if slices are used # check if slices are used
......
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