crash when synchronizing customers

Bug #1276645 reported by Alexandre Fayolle - camptocamp
This bug report is a duplicate of:  Bug #1210775: group_id problem in Partner Import. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP Connector - Magento
New
Undecided
Unassigned

Bug Description

Hello,

I've faced the following crash when attempting an initial sync of partners from a Magento 1.7.0.0 site, with python magento-0.4 and the connector in version 2.3.1:

  File "/srv/openerp/instances/openerp_test_avosdim/parts/connector/connector/queue/worker.py", line 122, in run_job
    job.perform(session)
  File "/srv/openerp/instances/openerp_test_avosdim/parts/connector/connector/queue/job.py", line 472, in perform
    self.result = self.func(session, *self.args, **self.kwargs)
  File "/srv/openerp/instances/openerp_test_avosdim/parts/magentoerpconnect/magentoerpconnect/unit/import_synchronizer.py", line 333, in import_record
    importer.run(magento_id, force=force)
  File "/srv/openerp/instances/openerp_test_avosdim/parts/magentoerpconnect/magentoerpconnect/unit/import_synchronizer.py", line 182, in run
    self._import_dependencies()
  File "/srv/openerp/instances/openerp_test_avosdim/parts/magentoerpconnect/magentoerpconnect/partner.py", line 279, in _import_dependencies
    if binder.to_openerp(record['group_id']) is None:
KeyError: 'group_id'

Some instrumenting of the code showed that the call made to magento to get the partner information is:

with magento.API(url, user, passwd) as api:
    p = api.call('customer.info', [28337, None])

which means the attributes argument is None. In that case, the magento server returns the bare minimum fields:

{'customer_id': '28337', 'updated_at': '2014-02-03 10:41:46', 'increment_id': None}

which causes the crash later on.

If I use a call such as

with magento.Customer(url, user, passwd) as customer_api:
    p = customer_api.info(28337, None)

then I get a much nicer set of keys in the dictionary, including the group_id key.

Reading the code of the python magento module, I tested:

with magento.API(url, user, passwd) as api:
    p = api.call('customer.info', [28337]) # drop the None argument!

and this gives the expected result.

So I think the GenericAdapter.read method should be updated to not pass the attributes arguement if it is None.

Related branches

description: updated
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Probably a duplicate of lp:1210775

Magento is supported on PHP versions 5.2.13 - 5.3.24. A patch has been published on the Magento's website for the version 5.4: http://magento.com/blog/magento-news/magento-now-supports-php-54#.Uud_3bQweUk

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

I confirm this is a duplicate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.