Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

how to solve " AttributeError: 'function' object has no attribute 'routing_type' " problem in Odoo

By
Piyush Suva
on 3/14/15, 3:49 AM 1,357 views

import openerp
from openerp.osv import fields, osv
from openerp import SUPERUSER_ID
from openerp.addons.web.controllers.main import DataSet
from openerp.addons.web import http
from openerp.addons.web.http import request
import json

original_call_kw = DataSet.call_kw

@http.route(['/web/dataset/call_kw', '/web/dataset/call_kw/<path:path>'], type='json', auth="user")
def call_kw(self, model, method, args, kwargs, path=None):
    fct_src = original_call_kw
    cr,uid, context= request.cr, request.uid, request.context
    print 'YYYYYYY..........',cr, uid
    return fct_src(self,model, method, args, kwargs)

DataSet.call_kw = call_kw

 

If you Add This code in any installed module' py it gives below traceback:

2015-02-14 07:31:18,244 6158 ERROR v8_test openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
  File "/home/workspace/openerp/odoo/openerp/http.py", line 476, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/workspace/openerp/odoo/openerp/http.py", line 495, in dispatch
    result = self._call_function(**self.params)
  File "/home/workspace/openerp/odoo/openerp/http.py", line 311, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/workspace/openerp/odoo/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/serpentcs/workspace/openerp/odoo/openerp/http.py", line 308, in checked_call
    return self.endpoint(*a, **kw)
  File "/home/workspace/openerp/odoo/openerp/http.py", line 685, in __call__
    return self.method(*args, **kw)
  File "/home/workspace/openerp/odoo/openerp/http.py", line 361, in response_wrap
    if isinstance(response, Response) or f.routing_type == 'json':
AttributeError: 'function' object has no attribute 'routing_type'

 How to solve this problem?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/14/15, 3:49 AM
Seen: 1357 times
Last updated: 6/17/15, 3:53 AM