Odoo Help


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.


Insert/Update Hidden Field [Closed]

Mohammed Osman Gomda
on 4/16/13, 1:31 PM 1,060 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--
| 5 7 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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 4/16/13, 1:31 PM
Seen: 1060 times
Last updated: 3/16/15, 8:10 AM