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

AttributeError: 'NoneType' object has no attribute 'name_search'

By
Billiard R Made
on 11/7/14, 6:46 PM 1,610 views

I get an error when I try to run my module AttributeError: 'NoneType' object has no attribute 'name_search'

Below is my code,  please assist:

def _get_countries(self, cr, uid, context=None):

        cr.execute('SELECT res_country.code,res_country.name FROM res_country ORDER BY name')

        return cr.fetchall()

 

'nationality':fields.reference('Nationality', type='selection', selection=(_get_countries ), method=True),  ???

 

 

 

 

 

https://docs.google.com/a/digitaltreasure.co.bw/file/d/0B_BAgvBBQn_KMXFvZGtWaExmRDg/edit

Billiard R Made
on 11/8/14, 4:36 AM

try using function field,, field.function(type='selection')... update me if that solves the problem

Baiju
on 11/9/14, 11:32 PM
This worked. Thanks for your response.

    def _get_countries(self, cr, uid, context=None):
        cr.execute('SELECT res_country.code,res_country.name FROM res_country ORDER BY name')
        return cr.fetchall()


'nationality':fields.selection(_get_countries,'Nationality',required=True),

On 10 November 2014 06:32, Baiju KS <baijuks@hotmail.com> wrote:

try using function field,, field.function(type='selection')... update me if that solves the problem

--
Baiju KS
Sent by OpenERP S.A. using Odoo about Forum Post AttributeError: 'NoneType' object has no attribute 'name_search'

Billiard R Made
on 11/10/14, 7:40 AM
2

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 11/10/14, 8:56 AM

try using function field,, field.function(type='selection')... update me if that solves the problem

def _get_countries(self, cr, uid, context=None):
        cr.execute('SELECT res_country.code , res_country.name FROM res_country ORDER BY name')
        return cr.fetchall()



'nationality':fields.selection(_get_countries,'Nationality',required=True),

 

 

Is it possible to use this command------------ def _get_countries(self, cr, uid, context=None): #cr.execute('SELECT res_country.code , res_country.name FROM res_country ORDER BY name') cr.execute('SELECT res_partner.name from res_partner') return cr.fetchall()

Odoo
on 11/25/14, 12:41 AM
0
Billiard R Made
On 11/10/14, 3:27 PM

This worked.  Baiju, Thanks for your response.

    def _get_countries(self, cr, uid, context=None):
        cr.execute('SELECT res_country.code , res_country.name FROM res_country ORDER BY name')
        return cr.fetchall()



'nationality':fields.selection(_get_countries,'Nationality',required=True),

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

2 follower(s)

Stats

Asked: 11/7/14, 6:46 PM
Seen: 1610 times
Last updated: 3/16/15, 8:10 AM