c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #21691
Re: [Bug 747776] Re: [6.02] error opening crm categories
On Monday 11 April 2011, you wrote:
> Hmm,
> It's not worth to make a video showing me clicking on
> Sales/config/helpdesk/categories ... aynd there is no more server output
> than in the bug message.
>
> the question is, why does
> reads = self.read(cr, uid, ids, ['name', 'parent_id'], context)
> returns
> {'parent_id': False, 'name': u'Sales Department', 'id': 1}
> instead of
> [{'parent_id': False, 'name': u'Sales Department', 'id': 1}]
>
> and why only in my installation ?
Well, this is a "dark corner" of the framework:
In the addons code, we meet both cases of
res1 = obj.read(cr, uid, ids=4, ...)
and
res2 = obj.read(cr, uid, ids=[1,2,3], ...)
(same with the browse(.., ids=?) one)
The de-facto definition of this function is that if you supply an int/long id,
it returns a single dict result. If you supply anything else[1] (we expect
list/tuple), it returns a list of dicts.
So, res1 = {'id': 4, 'foo': ...}
and res2 = [{'id': 1, 'foo': ...}, ... ]
I know the framework is not very consistent this way. You'd expect the
function to return the same type of results. But the problem is that it's used
so much (and is such a basic fn) that we cannot just change it. It would break
the API in a way that all rest of the code needs to be adapted.
[1] in a twisted way, something that evaluates to an int may result in a list
return. Most probably, however, it will bork because we'd iterate on it.
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/747776
Title:
[6.02] error opening crm categories
Status in OpenERP Modules (addons):
Confirmed
Bug description:
tying to open crm categories
(had to deaktivate name_get to proceed)
Environment Information :
System : Linux-2.6.37.1-1.2-desktop-x86_64-with-SuSE-11.4-x86_64
OS Name : posix
LSB Version: core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch
Distributor ID: SUSE LINUX
Description: openSUSE 11.4 (x86_64)
Release: 11.4
Codename: Celadon
Operating System Release : 2.6.37.1-1.2-desktop
Operating System Version : #1 SMP PREEMPT 2011-02-21 10:34:10 +0100
Operating System Architecture : 64bit
Operating System Locale : en_US.UTF8
Python Version : 2.7.0
OpenERP-Client Version : 6.0.1
Last revision No. & ID :1805 nch@xxxxxxxxxxx-20110204062049-cinbbgay477geqem
Traceback (most recent call last):
File "/home/terp/OpenERP/trunk/openobject-server/6.0/bin/netsvc.py", line 489, in dispatch
result = ExportService.getService(service_name).dispatch(method, auth, params)
File "/home/terp/OpenERP/trunk/openobject-server/6.0/bin/service/web_services.py", line 599, in dispatch
res = fn(db, uid, *params)
File "/home/terp/OpenERP/trunk/openobject-server/6.0/bin/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/terp/OpenERP/trunk/openobject-server/6.0/bin/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/terp/OpenERP/trunk/openobject-server/6.0/bin/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/terp/OpenERP/trunk/openobject-addons/6.0/crm/crm.py", line 668, in name_get
name = record['name']
TypeError: string indices must be integers, not str
References