Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Insert/Update Hidden Field [Closed]
The Question has been closedby
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
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 4/16/13, 1:31 PM|
|Seen: 1169 times|
|Last updated: 3/16/15, 8:10 AM|