diff --git a/product/ERP5/Document/AccountingTransactionLine.py b/product/ERP5/Document/AccountingTransactionLine.py index 7596c635c0f55ffa29181894ea21e0fceb877ce2..572fdf486dd120f0ec36fffedc67e2d1dce15ff5 100755 --- a/product/ERP5/Document/AccountingTransactionLine.py +++ b/product/ERP5/Document/AccountingTransactionLine.py @@ -132,7 +132,7 @@ class AccountingTransactionLine(DeliveryLine): """ if kw.has_key('source'): self._setSource(kw['source']) - if kw.has_key('destination') and not kw.has_key('source'): + elif kw.has_key('destination') : self._setDestination(kw['destination']) DeliveryLine._edit(self, REQUEST=REQUEST, force_update = force_update, **kw) @@ -175,14 +175,13 @@ class AccountingTransactionLine(DeliveryLine): """ result = self.getInventoriatedQuantity() resource = self.getResourceValue() - source = self.getSourceValue() + source_section = self.getSourceSectionValue() - if source is not None and resource is not None: - # XXX convertCurrency is not defined - # ... so for now, we return 1 - return 1 + if source_section is not None and \ + resource is not None and \ + hasattr(resource, 'convertCurrency') : return resource.convertCurrency(result, - source.getPriceCurrencyValue()) + source_section.getPriceCurrencyValue()) return None security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetPrice') @@ -203,4 +202,4 @@ class AccountingTransactionLine(DeliveryLine): This is required by accounting law. One can not account USD (in a EUR based company) without defining the equivalent in EUR. """ - return 1.0 \ No newline at end of file + return 1.0