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.

0

AttributeError: 'NoneType' object has no attribute 'search' [Closed]

By
priyankahdp
on 3/27/13, 7:31 AM 3,935 views

The Question has been closed

by
priyankahdp
on 04/22/2013 05:01:56

Please advice me on above error.I need to load workers related to my division.my whole module code uploaded to here for more convenience

github

line 207

def onchange_division(self, cr, uid, ids, division_id, context=None):
    if division_id:
        division_self = self.pool.get('bpl.division.n.registration')
        division_browse = division_self.browse(cr, uid, division_id, context=context)
        """    self.pool.get('bpl.division.n.registration') means get that object      """
        """    division_self.browse means using division id search it for get record      """
        result_id=division_browse.id
        worker_object = self.pool.get('bpl.woker')            
        search_condition = [
                          ('bpl_division_id', '=', result_id)
                          ]
        worker_list=worker_object.search(cr, uid, search_condition, context=None)
        return worker_list

line 266

<field name='bpl_division_id' on_change="onchange_division(bpl_division_id)" />

It is usually bid a spelling issue of the model name, the error is so misleading...

aheficent
on 7/6/16, 7:24 AM
1

Martin

--Martin--
1978
| 5 6 8
Cornwall, Canada
--Martin--

Analysing, designing, coding and mentoring since 1975. Kilobytes to terabytes. Punch cards to punchy sites. My OpenERP video series: http://www.youtube.com/playlist?list=PLq7op4J183lX44ZlXPiHxUpRvmmRDtxye My Google Speadsheets --> OpenERP Data Pump project: http://martinhbramwell.github.io/GData_OpenERP_Data_Pump My email (with spaces removed) : mhb . warehouseman @ gmail . com

Martin
On 3/27/13, 9:55 AM

The failure is here:

worker_object.search(cr, uid, search_condition, context=None)

You are attempting a search on "worker_object" but it is of type "None".

It was instantiated with the command below, which found no valid result.

worker_object = self.pool.get('bpl.woker')

Instead of trying to "get" a 'bpl.woker' I suspect you want a 'bpl.worker'.

thanks Martin,.if u can please help me to this error
http://help.openerp.com/question/8391/how-to-load-child-records-to-fields/

priyankahdp
on 3/27/13, 10:42 AM
0
duh386
On 3/27/13, 8:02 AM

You can write your function for calculating default value, something like

def _your_function(self, cr, uid, context=None):
    ...Some actions or sql-queries...
    return value

_defaults = {
    'field_name': _your_function,
}

Or you can use standard sequence functional (with using model ir.sequence).

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 3/27/13, 7:31 AM
Seen: 3935 times
Last updated: 3/16/15, 8:10 AM