← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 645263] Re: c2c_currency_rate_update outdated XML lib and a crash

 

Oups, sorry, my previous comment was wrong ; the error message "cannot
import name xpath !!!" is caused by the absence of the old pyXML lib,
not by the issue that I describe ! Sorry for this mistake.

But the third bug is still valid. In fact, the exact issue depend on the Webservice :
- Admin.ch : if your main_currency != CHF, then you can't update the rate of the 'CHF' currency (but it will work fine for other currencies)
- ECB : the computation is wrong if main_currency != EUR
- PL NBP : the computation is wrong if main_currency != PLN

I confirm that my work will fix this issue too.

-- 
c2c_currency_rate_update outdated XML lib and a crash
https://bugs.launchpad.net/bugs/645263
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: In Progress

Bug description:
I am currently testing the module "c2c_currency_rate_update" from extra-addons, stable branch. I am using the current stable branch for server and addons.

The great news is that I managed to update several currencies with the service "Yahoo Finance" !

But it seems I found 2 issues with the module. I am a beginner in Python, so I may be wrong or say stupid things, please take it into account when reading this.

1) First issue : deprecated pyxml lib makes ECB and Admin.ch service unusable ?

In the file currency_rate_update.py, for the service ECB (European Central Bank) and Admin.ch, there is an import of a library :

from xml import xpath

(line 365 for Admin.ch and 417 for ECB)

For what I understand, this lib is part of the pyXML lib, available from this project : http://sourceforge.net/projects/pyxml/
Under Ubuntu, the lib was provided by the package python-xml. Since Karmic, this lib is no longer provided, see http://packages.ubuntu.com/search?keywords=python-xml&searchon=names&suite=all&section=all
Probably, the reason for that is written on http://sourceforge.net/projects/pyxml/ :

PyXML is no longer maintained.

So, shouldn't we use another XML lib ? If yes, which one do you suggest ?

2) if I start the server with --log-level=debug, when I do anything in the "Currency autoupdate configuration" (under Administration > Users > Companies) and save it, or when I click on Refresh currencies, or when the scheduled action to refresh currencies is executed, I get the following crash in the logs :

[2010-09-22 16:12:38,161][erp_des4] DEBUG:sql:bad query: select company_id from res_currency
[2010-09-22 16:12:38,162][erp_des4] DEBUG:sql:None
[2010-09-22 16:12:38,162][erp_des4] DEBUG:sql:[01]: ERREUR:  la colonne « company_id » n'existe pas
[2010-09-22 16:12:38,162][erp_des4] DEBUG:sql:[02]: LIGNE 1 : select company_id from res_currency
[2010-09-22 16:12:38,163][erp_des4] DEBUG:sql:[03]:                  ^
[2010-09-22 16:12:38,164][erp_des4] DEBUG:sql:[01]: File "/usr/lib/python2.6/threading.py", line 504, in __bootstrap
[2010-09-22 16:12:38,164][erp_des4] DEBUG:sql:[02]:     self.__bootstrap_inner()
[2010-09-22 16:12:38,164][erp_des4] DEBUG:sql:[03]:   File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner

I confirm there is no company_id field on the res_currency object !

Do you confirm these two issues ? If yes, I am willing to spend time to try to fix them, but :
- for point n°1, I need some advice on which python XML lib we should use now
- for point n°2, I will probably need some help, because I don't see what triggers this bad SQL query...