Context is not defined

Bug #1260804 reported by OscarAlca
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
OpenERP Publisher's Warranty Team

Bug Description

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

==========================UPDATE====================================
Forgot to say that I also tested on runbot at the moment I posted this bug getting the same odd result.

Tags: maintenance
OscarAlca (oscarolar)
description: updated
Changed in openobject-server:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Revision history for this message
OscarAlca (oscarolar) wrote :

using context.get('uid') was just an example because I knew you can replicate the error with this value, I'm using a special value in the context not the uid, but anyway, the traceback says:
NameError: name 'context' is not defined
IMHO this should not happen, because is saying that it cant find the variable context, another weird thing is that this issue only happens on the example posted on the bug (the Tasks action), tried on the res.partner action the exact same domain [('user_id','=',context.get('uid'))] and it works like magic, no error shown, can this be an addons bug instead of a openerp-server bug?

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.