Odoo Help


When I try to save a form it raises an error AttributeError: 'NoneType' object has no attribute 'ids' [Closed]

on 8/28/14, 4:33 AM 1,634 views

The Question has been closed for reason: duplicate question

on 08/29/2014 00:34:17

I want to fetch some values from res.partner use browse method.But i got this error why need a help,Here I attached my code sample


 class res_partner(osv.osv):
               'total':fields.char('First Name'),


def create(self, cr, uid, ids, context=None):
        for i in self.browse(cr,uid,ids):
        return super(res_partner, self).create(cr, uid, ids,{'total':'val_total'}, context=context)

Need a help...





Kazim Mirza

--Kazim Mirza--
--Kazim Mirza--
Kazim Mirza
On 8/28/14, 10:36 AM

Hello Libu Koshy,

Def Create method is used for create a new record into the database.

so in create() method you have not specify the id because there is no id for record because there is no record.

If there is a ny record you want to update it so you have to use write() methods with perticular id.

but Create() doesnt contain any ids. you are about to create a new record .


def create(self, cr, uid,vals, context=None):

        if context is None:
            context = {}

        for i in self.browse(cr,uid,ids):

            for record in i:

            vals = {'total':val_total}
        return super(res_partner, self).create(cr, uid, vals, context=context)

Please use abow  code.

I tried your code but still have same problem...####ERROR File "/opt/openerp/server/openerp/addons/partner_custom/cust_invoice_info.py", line 61, in create val_name=i.name AttributeError: 'NoneType' object has no attribute 'name'

on 8/29/14, 12:31 AM

check it

Kazim Mirza
on 8/29/14, 1:21 AM

File "/opt/openerp/server/openerp/addons/partner_custom/cust_invoice_info.py", line 1016, in create for record in i: TypeError: 'NoneType' object is not iterable

on 8/29/14, 3:35 AM

René Schuster

--René Schuster--
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 8/28/14, 5:06 AM

The create() method works only for a single record.

The function signature is: create(cr, user, vals, context=None)


When either name or mail are not entered on creation, their value will become False (though I thougt they wouldn't be in the value dict). So make sure both fields are filled, using required=True, or change the code to catch the missing field values.

For the latter, change your function to:

def create(self, cr, uid, values, context=None):
    name = values.get('name','');
    mail = values.get('email','');
    total =  '';
    if name:
        total += name;
    if mail:
        total += ', ' + 'mail;
    values['total'] = total;
    return super(res_partner, self).create(cr, uid, values, context=context);


self is required ? inside create( uid, values, context=None) ?

on 8/28/14, 5:38 AM

I tried your code but error occurs####### TypeError: cannot concatenate 'str' and 'bool' objects

on 8/28/14, 5:41 AM

Ofcourse. Sorry. I will fix it immediately!

René Schuster
on 8/28/14, 5:41 AM

Thank you Rene..its working

on 8/28/14, 7:19 AM

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

1 follower(s)


Asked: 8/28/14, 4:33 AM
Seen: 1634 times
Last updated: 3/16/15, 8:10 AM