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.


how to add fields , fields.function

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

on 5/8/13, 1:41 PM

i have this error

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"

on 5/8/13, 3:04 PM
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),
On 5/8/13, 2:28 PM

i have this error :(

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

Just add : type="char"

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