Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3 Antworten
7434 Ansichten

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 )

thanks

Avatar
Verwerfen
Beste Antwort

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),
}
Avatar
Verwerfen
Autor

thanks a lot

Autor

i have this error

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

Autor

thanks just i should add type="char"

Autor Beste Antwort

i have this error :(

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

Just add : type="char"

Avatar
Verwerfen
Beste Antwort
'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),
Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Nov. 20
6197
1
Juni 15
5058
1
Mai 21
10632
1
Juli 16
7419
1
Juli 15
8580