Commit 85aca8f8 authored by Julien Muchembled's avatar Julien Muchembled

small optimization

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@38015 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f785c9e3
......@@ -109,7 +109,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
resource = prevision_movement.getResourceValue()
if resource is not None:
base = resource.getBaseUnitQuantity()
if tolerance_base == 'resource_price_precision':
elif tolerance_base == 'resource_price_precision':
# Precision of this movement's resource base unit price
base = prevision_movement.getBaseUnitPrice()
# fallback to price currency, like in Amount.getPricePrecision
......@@ -117,19 +117,19 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
currency = prevision_movement.getPriceCurrencyValue()
if currency is not None:
base = currency.getBaseUnitQuantity()
if tolerance_base == 'price_currency_precision':
elif tolerance_base == 'price_currency_precision':
# Precision of this movement's price currency
currency = prevision_movement.getPriceCurrencyValue()
if currency is not None:
base = currency.getBaseUnitQuantity()
if tolerance_base == 'source_section_currency_precision':
elif tolerance_base == 'source_section_currency_precision':
# Precision of this source section's accounting currency
section = prevision_movement.getSourceSectionValue()
if section is not None:
currency = section.getPriceCurrencyValue()
if currency is not None:
base = currency.getBaseUnitQuantity()
if tolerance_base == 'destination_section_currency_precision':
elif tolerance_base == 'destination_section_currency_precision':
# Precision of this destination section's accounting currency
section = prevision_movement.getDestinationSectionValue()
if section is not None:
......@@ -156,7 +156,6 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
'The difference of ${property_name} between decision and prevision is less than ${value} times of the prevision value.',
dict(property_name=tested_property,
value=relative_tolerance_max))
return None
def _round(self, value):
from decimal import (Decimal, ROUND_DOWN, ROUND_UP, ROUND_CEILING,
......
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