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.


separate long name into several field

on 5/17/13, 9:07 AM 1,345 views

I have a class:

class activeuser(osv.osv):

_name = activeuser

_columns = {

'name':fields.char('Name', size=128),

'description_about':fields.text('About Name'),



I want get every word of 'name' field into new fields that I will create, lets say:





How to do that?

Can Create Three fields First Name, Last Name, Middle Name in the fourth fields Complete Name con-cat all the three fields using Functional Fields or on_change event

on 5/17/13, 9:39 AM

can you explain more spesific?

on 5/17/13, 10:12 AM


| 5 4 7
Bikaner, India

OpenERP Devloper at SunARC Technology

On 5/17/13, 10:28 AM


overridden Create and Write Method

class activeuser(osv.osv):
_name = activeuser
_columns = {
'first_name':fields.char('First Name', size=128),
'middle_name':fields.char('Middle Name', size=128),
'last_name':fields.char('Last Name', size=128),
'name':fields.char('Full Name', size=128),
'description_about':fields.text('About Name'),

    def create(self, cr, user, vals, context=None):
        vals['full_name'] = vals['first_name'] + ' ' + str(vals['middle_name'] or '') + ' ' + vals['last_name']
        return super(activeuser,self).create(cr, user, vals, context)

    def write(self, cr, user, ids, vals, context=None):
        for res in self.browse(cr,user,ids):
            print "name"
        if not 'first_name' in vals:   
            vals['first_name'] =  res.first_name
        if not 'middle_name' in vals:       
            vals['middle_name'] =  res.middle_name
        if not 'last_name' in vals:           
            vals['last_name'] =  res.last_name
        vals['full_name'] = vals['first_name'] + ' ' + str(vals['middle_name'] or '') + ' ' + vals['last_name']
        return super(activeuser,self).write(cr, user, ids, vals, context)

ok, thanks in advance, I'll try first, how to apply it in on_change method?

on 5/17/13, 10:31 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 5/17/13, 9:07 AM
Seen: 1345 times
Last updated: 3/16/15, 8:10 AM