Odoo Help


Inheritet Model's field can not be changed over method

Webmaster Anker_Isak
on 4/18/16, 6:15 AM 524 views

In the folloing code i extend the model partnet in my custommodule. I want to set sequence number for the new field "kundennummer" on a partner.  But in the vals of the model partner you can't find the new field "kundennummer", so the method create doesn't work! What should i do?

class Partner(models.Model):


_inherit= 'res.partner'

instructor=fields.Boolean("Instructor", default=False)

kundennummer=fields.Char(required=True, copy=False, readonly=True, index=True, default=lambda self: _('New'))


string="Attended Sessions", readonly=True)


def create(self, vals):



vals['function']=self.env['ir.sequence'].next_by_code('code') or 'New'

if vals.get('kundennummer', 'New') == 'New':

vals['kundennummer'] = self.env['ir.sequence'].next_by_code('code') or 'New'

result = super(res_partner, self).create(vals)

return result

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: 4/18/16, 6:15 AM
Seen: 524 times
Last updated: 4/18/16, 6:56 AM