Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
7464 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis

thanks a lot

Penulis

i have this error

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

Penulis

thanks just i should add type="char"

Penulis Jawaban Terbai

i have this error :(

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

Just add : type="char"

Avatar
Buang
Jawaban Terbai
'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
Buang
Post Terkait Replies Tampilan Aktivitas
2
Nov 20
6225
1
Jun 15
5094
1
Mei 21
10662
1
Jul 16
7450
1
Jul 15
8616