Commit 704daf00 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

instead of using AccountingTransaction_isDestinationCurrencyConvertible

for Simulation Movement, implement the same logic here.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24562 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 62191dac
...@@ -198,31 +198,33 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): ...@@ -198,31 +198,33 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
#currency of the source/destination section #currency of the source/destination section
currency = new_mvmt.getResourceValue() currency = new_mvmt.getResourceValue()
if currency is not None: if currency is not None:
if new_mvmt.AccountingTransaction_isDestinationCurrencyConvertible(): currency_url = currency.getRelativeUrl()
precision = \ dest_section = new_mvmt.getDestinationSectionValue()
new_mvmt.getDestinationSectionValue().getPriceCurrencyValue().\ if dest_section is not None:
getQuantityPrecision() dest_currency = dest_section.getPriceCurrencyValue()
dest_exchange_ratio = \ else:
currency.getPrice(context=new_mvmt.asContext( dest_currency = None
categories=['price_currency/%s' if dest_currency is not None and currency != dest_currency:
%new_mvmt.getDestinationSectionValue().getPriceCurrency(), precision = dest_currency.getQuantityPrecision()
'resource/%s'% new_mvmt.getResourceRelativeUrl()], dest_exchange_ratio = currency.getPrice(context=new_mvmt.asContext(
start_date=new_mvmt.getStopDate())) categories=['price_currency/%s' % dest_currency.getRelativeUrl(),
'resource/%s' % currency_url],
start_date=new_mvmt.getStartDate()))
if dest_exchange_ratio is not None: if dest_exchange_ratio is not None:
new_mvmt.edit(destination_total_asset_price=round( new_mvmt.edit(destination_total_asset_price=round(
(dest_exchange_ratio* (dest_exchange_ratio*
applied_rule.getParentValue().getTotalPrice()),precision)) applied_rule.getParentValue().getTotalPrice()),precision))
if new_mvmt.AccountingTransaction_isSourceCurrencyConvertible(): source_section = new_mvmt.getSourceSectionValue()
precision = \ if source_section is not None:
new_mvmt.getSourceSectionValue().getPriceCurrencyValue().\ source_currency = source_section.getPriceCurrencyValue()
getQuantityPrecision() else:
source_exchange_ratio = \ source_currency = None
currency.getPrice(context=new_mvmt.asContext( if source_currency is not None and currency != source_currency:
categories=['price_currency/%s' precision = source_currency.getQuantityPrecision()
%new_mvmt.getSourceSectionValue().getPriceCurrency(), source_exchange_ratio = currency.getPrice(context=new_mvmt.asContext(
'resource/%s'% categories=['price_currency/%s' % source_currency.getRelativeUrl(),
new_mvmt.getResourceRelativeUrl()], 'resource/%s' % currency_url],
start_date=new_mvmt.getStartDate())) start_date=new_mvmt.getStartDate()))
if source_exchange_ratio is not None: if source_exchange_ratio is not None:
new_mvmt.setSourceTotalAssetPrice(round( new_mvmt.setSourceTotalAssetPrice(round(
......
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