Commit 4ec6aa53 authored by Mame Coumba Sall's avatar Mame Coumba Sall

modification on expand method to so that the asset_price won't be copied on the invoice lines

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24358 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent acc3860a
...@@ -197,50 +197,38 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): ...@@ -197,50 +197,38 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
#set asset_price on movement when resource is different from price #set asset_price on movement when resource is different from price
#currency of the source/destination section #currency of the source/destination section
currency = new_mvmt.getResourceValue() currency = new_mvmt.getResourceValue()
if new_mvmt.AccountingTransaction_isDestinationCurrencyConvertible(): if currency is not None:
precision = \ if new_mvmt.AccountingTransaction_isDestinationCurrencyConvertible():
new_mvmt.getDestinationSectionValue().getPriceCurrencyValue().\ precision = \
new_mvmt.getDestinationSectionValue().getPriceCurrencyValue().\
getQuantityPrecision() getQuantityPrecision()
dest_exchange_ratio = \ dest_exchange_ratio = \
currency.getPrice(context=new_mvmt.asContext( currency.getPrice(context=new_mvmt.asContext(
categories=['price_currency/currency_module/%s' % categories=['price_currency/%s'
new_mvmt.getDestinationSectionValue().getPriceCurrencyId(), %new_mvmt.getDestinationSectionValue().getPriceCurrency(),
'resource/%s'% new_mvmt.getResourceRelativeUrl()], 'resource/%s'% new_mvmt.getResourceRelativeUrl()],
start_date=new_mvmt.getStopDate())) start_date=new_mvmt.getStopDate()))
if dest_exchange_ratio is None: if dest_exchange_ratio is not None:
raise AssertionError 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))
relative_parent_movement = applied_rule.getParentValue()
relative_parent_movement.edit(destination_total_asset_price=\ if new_mvmt.AccountingTransaction_isSourceCurrencyConvertible():
(new_mvmt.getDestinationTotalAssetPrice())) precision = \
relative_applied_rule = relative_parent_movement.getParentValue() new_mvmt.getSourceSectionValue().getPriceCurrencyValue().\
parent_movement = relative_applied_rule.getParentValue()
parent_movement.edit(destination_total_asset_price=\
new_mvmt.getDestinationTotalAssetPrice())
if new_mvmt.AccountingTransaction_isSourceCurrencyConvertible():
precision = \
new_mvmt.getSourceSectionValue().getPriceCurrencyValue().\
getQuantityPrecision() getQuantityPrecision()
source_exchange_ratio = currency.getPrice(context=new_mvmt.asContext( source_exchange_ratio = \
categories=['price_currency/currency_module/%s' % currency.getPrice(context=new_mvmt.asContext(
new_mvmt.getSourceSectionValue().getPriceCurrencyId(), categories=['price_currency/%s'
%new_mvmt.getSourceSectionValue().getPriceCurrency(),
'resource/%s'% 'resource/%s'%
new_mvmt.getResourceRelativeUrl()], new_mvmt.getResourceRelativeUrl()],
start_date=new_mvmt.getStartDate())) start_date=new_mvmt.getStartDate()))
if source_exchange_ratio is None: if source_exchange_ratio is not None:
raise AssertionError new_mvmt.setSourceTotalAssetPrice(round(
new_mvmt.setSourceTotalAssetPrice(round( (source_exchange_ratio*applied_rule.getParentValue().getTotalPrice()),
(source_exchange_ratio*applied_rule.getParentValue().getTotalPrice()),
precision)) precision))
relative_parent_movement = applied_rule.getParentValue()
relative_parent_movement.setSourceTotalAssetPrice\
(new_mvmt.getSourceTotalAssetPrice())
relative_applied_rule = relative_parent_movement.getParentValue()
parent_movement = relative_applied_rule.getParentValue()
parent_movement.setSourceTotalAssetPrice\
(new_mvmt.getSourceTotalAssetPrice())
# Pass to base class # Pass to base class
Rule.expand(self, applied_rule, force=force, **kw) Rule.expand(self, applied_rule, force=force, **kw)
......
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