This question has been flagged

Hi !

I have a weird issue there. Here's my code :

class xml_request(osv.osv):
    _name = 'xml.request'
    _columns = {
        'config_id': fields.many2one('synconfig', 'Config id'),
        # [...]
    }
    def name_get(self, cr, uid, ids, context=None):
        res = []
        for rec in self.browse(cr, uid, ids, context=context):
            conf = rec.config_id
            # [...]
        return res

Here's the error:

Traceback (most recent call last):
    File "/home/openerp/server/openerp/netsvc.py", line 297, in dispatch_rpc
        result = ExportService.getService(service_name).dispatch(method, params)
    File "/home/openerp/server/openerp/service/web_services.py", line 626, in dispatch
        res = fn(db, uid, *params)
    File "/home/openerp/server/openerp/osv/osv.py", line 190, in execute_kw
        return self.execute(db, uid, obj, method, *args, **kw or {})
    File "/home/openerp/server/openerp/osv/osv.py", line 132, in wrapper
        return f(self, dbname, *args, **kwargs)
    File "/home/openerp/server/openerp/osv/osv.py", line 199, in execute
        res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/openerp/server/openerp/osv/osv.py", line 187, in execute_cr
        return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/openerp/server/openerp/osv/orm.py", line 3679, in read
        result = self._read_flat(cr, user, select, fields, context, load)
    File "/home/openerp/server/openerp/osv/orm.py", line 3800, in _read_flat
        res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
    File "/home/openerp/server/openerp/osv/fields.py", line 468, in get
        context=context))
    File "/home/openerp/custom_addons/synconfig/xml_request/xml_request.py", line 71, in name_get
        conf = rec['config_id']
    File "/home/openerp/server/openerp/osv/orm.py", line 405, in __getitem__
        field_values = self._table.read(self._cr, self._uid, ids, field_names, context=self._context, load="_classic_write")
    File "/home/openerp/server/openerp/osv/orm.py", line 3679, in read
        result = self._read_flat(cr, user, select, fields, context, load)
    File "/home/openerp/server/openerp/osv/orm.py", line 3729, in _read_flat
        query += " ORDER BY " + order_by
TypeError: cannot concatenate 'str' and 'instancemethod' objects

EDIT:

Today, monday, I've not changed anything, but the error has changed ! :O Here's the traceback:

Traceback (most recent call last): 
    File "/home/openerp/server/openerp/netsvc.py", line 297, in dispatch_rpc 
        result = ExportService.getService(service_name).dispatch(method, params) 
    File "/home/openerp/server/openerp/service/web_services.py", line 626, in dispatch 
        res = fn(db, uid, *params) 
    File "/home/openerp/server/openerp/osv/osv.py", line 190, in execute_kw 
        return self.execute(db, uid, obj, method, *args, **kw or {}) 
    File "/home/openerp/server/openerp/osv/osv.py", line 132, in wrapper 
        return f(self, dbname, *args, **kwargs) 
    File "/home/openerp/server/openerp/osv/osv.py", line 199, in execute 
        res = self.execute_cr(cr, uid, obj, method, *args, **kw) 
    File "/home/openerp/server/openerp/osv/osv.py", line 187, in execute_cr 
        return getattr(object, method)(cr, uid, *args, **kw) 
    File "/home/openerp/server/openerp/osv/orm.py", line 2372, in search 
        return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count) 
    File "/home/openerp/server/openerp/osv/orm.py", line 4937, in _search 
        order_by = self._generate_order_by(order, query) 
    File "/home/openerp/server/openerp/osv/orm.py", line 4879, in _generate_order_by 
        self._check_qorder(order_spec) 
    File "/home/openerp/server/openerp/osv/orm.py", line 4771, in _check_qorder 
        if not regex_order.match(word):
TypeError: expected string or buffer

 

EDIT:

Tried upgrading openerp to latest version (still v7), tried with another new database, but I still get this error.

Avatar
Discard
Author

Omg what's wrong with code formating :O

Author Best Answer

OK, so, after going deep in the server files, after several "print this" and "print type(that)", I finally figured out what was wrong.

In fact, I had a function named "_order" in my object "xml.request". Renaming it, problem solved.

(Didn't realised that my "_order" function was overriding the "_order" member of osv.osv -_- )

Avatar
Discard
Best Answer

The problem originates form this row.

conf = rec.config_id

You need to add the field you want to show or otherwise its just the browse_record() method from the "synconfig" class you are saving in conf.

Avatar
Discard
Author

I know, in fact I'm using this browse record to find other browse records, fields and so on, in order to build the name I want this function to return. By question was about to solve, or at least find out why this problem occured there ? I've used browse records many times before, and I've never seen this error on these objects...