AttributeError: "Field 'version' does not exist in object 'browse_record(external.referential.version, 2)'"

Bug #1017409 reported by Angel Moya - Domatix
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Prestashop OpenERP Connector
Fix Released
Undecided
Unassigned

Bug Description

_import_resources get this error:

Server Traceback (most recent call last):
  File "/home/openerp/openerp-web/addons/web/common/http.py", line 592, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/service/web_services.py", line 572, in dispatch
    res = fn(db, uid, *params)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/openerp/openobject-extension/base_external_referentials/external_referentials.py", line 187, in import_referentials
    self.import_resources(cr, uid, ids, 'external.referential', context=context)
  File "/home/openerp/openobject-extension/base_external_referentials/external_osv.py", line 431, in import_resources
    res = self.pool.get(resource_name)._import_resources(cr, uid, external_session, defaults, method=method, context=context)
  File "/home/openerp/openobject-extension/base_external_referentials/decorator.py", line 48, in wrapped
    return func(self, cr, uid, argument, *args, **kwargs)
  File "/home/openerp/prestashoperpconnect/prestashoperpconnect/external_referential.py", line 138, in _import_resources
    if external_session.referential_id.version_id.version >= '1.5' or not external_session.referential_id.version_id.version:
  File "/usr/local/lib/python2.6/dist-packages/openerp-6.1-py2.6.egg/openerp/osv/orm.py", line 478, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'version' does not exist in object 'browse_record(external.referential.version, 2)'"

I change line 138 in prestashoperpconnect/external_referential.py :

if external_session.referential_id.version_id.version >= '1.5' or not external_session.referential_id.version_id.version:

to:

if external_session.referential_id.version_id.code >= 'prestashop15' or not external_session.referential_id.version_id.code:

because external.referential.version has no field named version, but has field named code.

Related branches

Revision history for this message
jerome (j1n-jerome-xqt) wrote :

Thanks !
But I've got the same error :

if external_session.referential_id.version_id.code >= 'prestashop15' or not external_session.referential_id.version_id.code:
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 478, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'version' does not exist in object 'browse_record(external.referential.version, 2)'"

Revision history for this message
jerome (j1n-jerome-xqt) wrote :

In prestashoperpconnect/external_referential.py :

 """TODO Make this more clean because I think this "version" field is not the best way to handle this
        (The 1.4.3 version of Prestashop don't have external shop group)
        """

Is'nt it possible to test if exists external shop group rather than test the version ?

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

I merged your fix, thanks!

Changed in prestashoperpconnect:
status: New → Fix Released
assignee: nobody → Angel Moya - Domatix (angelmoya)
assignee: Angel Moya - Domatix (angelmoya) → nobody
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.