Odoo Help


Insert/Update Hidden Field [Closed]

Mohammed Osman Gomda
on 4/16/13, 1:31 PM 1,688 views

The Question has been closed

Ray Carnes
on 04/17/2013 00:28:45

I have these columns lastname,firstname,middle, name(editable). I want to insert/update the name field when a new record is created/update like name=lastname +' '+ firstname +' '+ middle Any help please. Thanks

where do i cast my vote

Mohammed Osman Gomda
on 4/16/13, 1:51 PM

Francesco OpenCode

--Francesco OpenCode--

| 6 8 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/16/13, 1:42 PM

You must use the super method to inherit create and write:


def create(self, cr, uid, vals, context=None):
    vals['name'] = '%s %s %s' % (vals['lastname'],vals['firstname'],vals['middle'])
    return super(your_class, self).create(cr, uid, vals, context=None)


def write(self, cr, uid, ids, vals, context=None):
    lastname = 'lastname' in vals and vals['lastname'] or ''
    firstname = 'firstname' in vals and vals['firstname'] or ''
    middle = 'middle' in vals and vals['middle'] or ''
    vals['name'] = '%s %s %s' % (lastname,firstname,middle)
    return super(your_class, self).write(cr, uid, ids, vals, context=None)

Or create and onchange that fill name when fristname, lastname or middle change its value!

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: 4/16/13, 1:31 PM
Seen: 1688 times
Last updated: 3/16/15, 8:10 AM