Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
7457 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

ผู้เขียน

i have this error

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

ผู้เขียน

thanks just i should add type="char"

ผู้เขียน คำตอบที่ดีที่สุด

i have this error :(

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

Just add : type="char"

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
'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),
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ย. 20
6206
1
มิ.ย. 15
5087
1
พ.ค. 21
10659
1
ก.ค. 16
7431
1
ก.ค. 15
8586