Odoo Help


global name 'pool' is not defined error

on 5/3/13, 7:20 AM 3,717 views

class lead_target(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(lead_target, self).__init__(cr, uid, name, context=context)
self.localcontext.update({ 'time': time,
'get_name':self.get_name, 'pool': self.pool,
}) self.context = context

def get_name(self, form):       
    for order in crm_obj.browse(cr, uid, id):
        print namev,"hhhhhhhhhhhhhhhhhhhhhhhhhhh"   
    print x 

            global name 'pool' is not defined

-------------------------------->if i do this i got this error (<type 'exceptions.nameerror'="">, NameError("global name 'pool' is not defined",), <traceback object="" at="" 0x7f070c2f0ea8="">)


Drees Far

--Drees Far--
Drees Far
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 11/16/15, 4:25 AM

Hello my friend;

Hoping this may help you.

class lead_target(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):

super(lead_target, self).__init__(cr, uid, name, context)


'time': time,

'get_name':self.get_name, 'pool': self.pool,





def get_name(self, form, context=None):

if not context:

context = None




obj_ids = crm_obj.search(self.cr, self.uid, [])

res = crm_obj.read(self.cr, self.uid, obj_ids, ['id', 'name'], context)

for r in res :

objs = {}

name = r['name']


print name,"hhhhhhhhhhhhhhhhhhhhhhhhhhh"

print x

return res_list

Best Regards.

On 5/3/13, 7:23 AM


Re write as following

crm_obj = self.pool.get('crm.lead')

already i defind there

on 5/3/13, 7:24 AM

as Arif said: replace the occurance of 'pool' in crm_obj=pool.get('crm.lead') or any occurance of 'pool' by self.pool

Naresh Soni (nch)
on 5/3/13, 8:28 AM

Arif and Naresh are right. Instead of pool.get, you should use self.pool.get('your.object.name').

Sudhir Arya (SA)
on 11/14/15, 7:48 AM

pool which you have defined in localcontext inside __init__ method, cannot be used directly. It can only be used in your report template (RML, Qweb).

Sudhir Arya (SA)
on 11/14/15, 7:53 AM

friend, make us know if you have found the solution :)

Drees Far
on 11/17/15, 4:05 AM

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 5/3/13, 7:20 AM
Seen: 3717 times
Last updated: 11/16/15, 4:25 AM