Discussion:
[Erp5-dev] CurrencyExchange_getExchangeRateList - is it usable?
Łukasz Nowak
2007-02-05 13:36:10 UTC
Permalink
Hello,

As you can read in Message-Id: <200702051132.37265.jerome at nexedi.com> I
was advised to make my own automagic script for Source Conversion. To
obtain it I'll have to use
portal_skins/erp5_base/CurrencyExchange_getExchangeRateList, to fetch
well price for currency.

Well, I was testing this script. In this script there was used
'start_date' but in
portal_workflow/currency_exchange_line_interaction_workflow/scripts/CurrencyExchangeLine_updateMatrix

there is:
c.setCriterion('stop_date', min=context.getStartDate(), \
max=context.getStopDate())

if I change it to start_date like:
c.setCriterion('start_date', min=context.getStartDate(), \
max=context.getStopDate())

I'm getting exchange rates for my currencies.

Well, some questions:

* is it a bug, which makes
portal_skins/erp5_base/CurrencyExchange_getExchangeRateList unusable?
* what shall be changed? criterion setter on
portal_workflow/currency_exchange_line_interaction_workflow/scripts/CurrencyExchangeLine_updateMatrix
from stop_date to start_date or
portal_skins/erp5_base/CurrencyExchange_getExchangeRateList?
* shall be portal_skins/erp5_base/CurrencyExchange_getExchangeRateList
used to calculate conversion of currencies?

Thanks,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...''
Sebastien Robin
2007-02-05 14:28:49 UTC
Permalink
Post by Łukasz Nowak
Hello,
As you can read in Message-Id: <200702051132.37265.jerome at nexedi.com> I
was advised to make my own automagic script for Source Conversion. To
obtain it I'll have to use
portal_skins/erp5_base/CurrencyExchange_getExchangeRateList, to fetch
well price for currency.
Well, I was testing this script. In this script there was used
'start_date' but in
portal_workflow/currency_exchange_line_interaction_workflow/scripts/Currenc
yExchangeLine_updateMatrix
c.setCriterion('stop_date', min=context.getStartDate(), \
max=context.getStopDate())
c.setCriterion('start_date', min=context.getStartDate(), \
max=context.getStopDate())
I'm getting exchange rates for my currencies.
This should also work with stop_date.
Post by Łukasz Nowak
* is it a bug, which makes
portal_skins/erp5_base/CurrencyExchange_getExchangeRateList unusable?
It is already used here for erp5_banking business template, and it works
properly.
Post by Łukasz Nowak
* what shall be changed? criterion setter on
portal_workflow/currency_exchange_line_interaction_workflow/scripts/Currenc
yExchangeLine_updateMatrix from stop_date to start_date or
portal_skins/erp5_base/CurrencyExchange_getExchangeRateList?
You should see why the stop_date is not taken into account.
Post by Łukasz Nowak
* shall be portal_skins/erp5_base/CurrencyExchange_getExchangeRateList
used to calculate conversion of currencies?
Well, here are some suggestions:
- may be an api should be defined on ERP5/Document/Currency.py , we might
define some methods wich will call script that we can configure into the zmi.
- the returned value of CurrencyExchange_getExchangeRateList is not so
convenient, it is :
[base_price,discount_price]
but we might have many other kind of prices.

Seb.
Post by Łukasz Nowak
Thanks,
Luke
--
Sebastien Robin, Nexedi Project Manager
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Free / Open Source ERP Software for small and medium companies
http://www.erp5.org
Łukasz Nowak
2007-02-05 15:00:39 UTC
Permalink
Hello,

Sebastien Robin napisa?(a):
(...)
Post by Sebastien Robin
Post by Łukasz Nowak
* is it a bug, which makes
portal_skins/erp5_base/CurrencyExchange_getExchangeRateList unusable?
It is already used here for erp5_banking business template, and it works
properly.
You are right. I was using very old version of this script.
Post by Sebastien Robin
You should see why the stop_date is not taken into account.
It is taken into account. My fault.

(...)

It was my fault - now all its working. I'm sorry for trouble.

Thanks,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...''
Łukasz Nowak
2007-02-06 10:10:01 UTC
Permalink
Hello,

Sebastien Robin napisa?(a):
(...)
Post by Sebastien Robin
You should see why the stop_date is not taken into account.
I think that I'm not able to find out why it isn't working.
Post by Sebastien Robin
It is already used here for erp5_banking business template, and it works
properly.
So I'm doing something wrong. I've attached unit test which is
simulation of steps made by me for getting currency exchange system to
work. It is based on clicks made *from UI* on clean and fresh (todays)
system.

As you can see it do not works.

After changing:
'start_date':start_date
to
'stop_date':start_date
in CurrencyExchange_getExchangeRateList this test passes well.

So only one question remains: what have I done wrong?
I cannot figure out how to configure currencies correctly - I wasn't
able to find any tests, which would aim to it.

Thanks for any tip,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...''
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testCurrencyExchange.py
Type: text/x-python
Size: 5550 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20070206/e85cff0c/attachment.py>
Loading...