Odoo Help

0

Insert/Update Hidden Field [Closed]

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

The Question has been closed

by
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
0

Francesco OpenCode

--Francesco OpenCode--
3664
| 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:

CREATE:

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)

WRITE:

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.

Register

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)

Stats

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