← Back to team overview

openerp-india team mailing list archive

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

 

Hello,

Please ignore my previous comment!!!  the right code to make it work is
here:

1. In currency_rate_update.py -- function: run_currency_update, I added
1 more condition to ignore unsupported currencies:

....
rate_name = time.strftime('%Y-%m-%d')
                    for curr in service.currency_to_update :
                        do_create = True
                        if curr.name in res :    # Trinh added to ignore the unsupported currencies from the list. *********
                            for rate in curr.rate_ids :
......

2. I removed unsupported currencies function get_updated_currency of
class ECB_getter in file currency_rate_update.py, as here:

# Trinh added to remove unsupported currencies out of getting rate exchanges loop *********
        supported_currency_array = currency_array
        for curr in currency_array :
            if curr not in self.supported_currency_array :
                supported_currency_array.remove(curr)
        
        for curr in supported_currency_array: # Trinh changed to use supported_currency_array from currency_array ********
            self.validate_cur(curr)
            if curr == 'EUR':

Regards,
Trinh V Truong.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/645263

Title:
  c2c_currency_rate_update outdated XML lib and a crash

Status in OpenERP Addons (modules):
  Fix Released

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...

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/645263/+subscriptions