Odoo Help


how to add fields , fields.function

samir Guesmi
on 5/8/13, 1:25 PM 2,069 views

hi all,

nice to see you.

now, my problem ,if someone have any idea and can help me.

I try to add a field ,type of field : fields.funtion ( who concatenate two other field.char )



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 5/8/13, 1:33 PM

This is the code

_function_example(self, cr, uid, ids, name, arg, context=None):
    res = {}
    records = self.browse(cr, uid, ids)
    for record in records:
        res[record.id] = '%s%s' % (record.field_char_1, record.field_char_2)
    return res

_columns = {
    'your_function_field' : fields.function(_function_example, type='char', size=64, method=True, store=False),

thanks a lot

samir Guesmi
on 5/8/13, 1:41 PM

i have this error

samir Guesmi
on 5/8/13, 2:29 PM

I've update the code. Try now with the new code.

Francesco OpenCode
on 5/8/13, 2:38 PM

thanks just i should add type="char"

samir Guesmi
on 5/8/13, 3:04 PM
samir Guesmi
On 5/8/13, 2:28 PM

i have this error :(

Uncaught Error: [_.sprintf] expecting number but found string

Just add : type="char"

On 5/8/13, 11:14 PM
'your_function_field' : fields.function(_function_example, type='char', size=64, method=True, store=False),

Replace by:

'your_function_field' : fields.function(_function_example, string='your_string, type='char', size=64, method=True, store=False),

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