From e2ac3668b19d80446437d6d19f572ff61921365d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Mon, 3 Aug 2009 16:00:45 +0000 Subject: [PATCH] - currency is defined on prevision line and not on self git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28256 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/BPMInvoiceTransactionRule.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/product/ERP5/Document/BPMInvoiceTransactionRule.py b/product/ERP5/Document/BPMInvoiceTransactionRule.py index 268aea0f32..9cf040b0a2 100644 --- a/product/ERP5/Document/BPMInvoiceTransactionRule.py +++ b/product/ERP5/Document/BPMInvoiceTransactionRule.py @@ -52,6 +52,10 @@ class BPMInvoiceTransactionRule(BPMRule, PredicateMatrix): def _getCurrencyRatioByArrow(self, arrow, prevision_line): from Products.ERP5Type.Document import newTempSimulationMovement + try: + prevision_currency = prevision_line['resource_list'][0] + except IndexError: + prevision_currency = None temporary_movement = newTempSimulationMovement(self.getPortalObject(), '1', **prevision_line) exchange_ratio = None @@ -64,13 +68,13 @@ class BPMInvoiceTransactionRule(BPMRule, PredicateMatrix): 'price_currency', None) else: currency_url = None - if currency_url is not None and self.getResource() != currency_url: + if currency_url is not None and prevision_currency != currency_url: precision = section.getPriceCurrencyValue() \ .getQuantityPrecision() exchange_ratio = currency.getPrice( context=temporary_movement.asContext( categories=['price_currency/%s' % currency_url, - 'resource/%s' % self.getResource()], + 'resource/%s' % prevision_currency], start_date=temporary_movement.getStartDate())) return exchange_ratio -- 2.30.9