Comment 0 for bug 1260804

Revision history for this message
OscarAlca (oscarolar) wrote :

when adding to a window action a domain value that contains a context.get() it trows the following traceback:

2013-12-13 16:49:46,841 12533 ERROR clean openerp.netsvc: name 'context' is not defined
Traceback (most recent call last):
  File "/home/oalca/openerp/server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/oalca/openerp/server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/home/oalca/openerp/server/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/oalca/openerp/server/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/oalca/openerp/server/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/oalca/openerp/server/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/oalca/openerp/server/openerp/addons/base/ir/ir_ui_menu.py", line 336, in get_needaction_data
    dom = menu.action.domain and eval(menu.action.domain, {'uid': uid}) or []
  File "/home/oalca/openerp/server/openerp/tools/safe_eval.py", line 241, in safe_eval
    return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
NameError: name 'context' is not defined

the weird thing is that the domain filtering works properly, but always displays this error message.

test scenario:

Activate developer mode.

go to Project > Tasks > then edit the window action

in the field domain add this [('user_id','=',context.get('uid'))] <-- this is for test purposes, then click save and you will get the error.

context variable is supposed to be allways present in OpenERP but it is not working in this action in particular.

Thanks in advance