Commit 7d178cdd authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix a bug that causes an error if price_currency is missing.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24578 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6fd24d7b
...@@ -201,11 +201,11 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): ...@@ -201,11 +201,11 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
currency_url = currency.getRelativeUrl() currency_url = currency.getRelativeUrl()
dest_section = new_mvmt.getDestinationSectionValue() dest_section = new_mvmt.getDestinationSectionValue()
if dest_section is not None: if dest_section is not None:
dest_currency = dest_section.getPriceCurrencyValue() dest_currency_url = dest_section.getProperty('price_currency', None)
else: else:
dest_currency = None dest_currency_url = None
if dest_currency is not None and currency != dest_currency: if dest_currency_url is not None and currency_url != dest_currency_url:
precision = dest_currency.getQuantityPrecision() precision = dest_section.getPriceCurrency().getQuantityPrecision()
dest_exchange_ratio = currency.getPrice(context=new_mvmt.asContext( dest_exchange_ratio = currency.getPrice(context=new_mvmt.asContext(
categories=['price_currency/%s' % dest_currency.getRelativeUrl(), categories=['price_currency/%s' % dest_currency.getRelativeUrl(),
'resource/%s' % currency_url], 'resource/%s' % currency_url],
...@@ -217,11 +217,11 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): ...@@ -217,11 +217,11 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
source_section = new_mvmt.getSourceSectionValue() source_section = new_mvmt.getSourceSectionValue()
if source_section is not None: if source_section is not None:
source_currency = source_section.getPriceCurrencyValue() source_currency_url = source_section.getProperty('price_currency', None)
else: else:
source_currency = None source_currency_url = None
if source_currency is not None and currency != source_currency: if source_currency_url is not None and currency_url != source_currency_url:
precision = source_currency.getQuantityPrecision() precision = source_section.getPriceCurrency().getQuantityPrecision()
source_exchange_ratio = currency.getPrice(context=new_mvmt.asContext( source_exchange_ratio = currency.getPrice(context=new_mvmt.asContext(
categories=['price_currency/%s' % source_currency.getRelativeUrl(), categories=['price_currency/%s' % source_currency.getRelativeUrl(),
'resource/%s' % currency_url], 'resource/%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