콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
7432 화면

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),
아바타
취소
관련 게시물 답글 화면 활동
2
11월 20
6197
1
6월 15
5058
1
5월 21
10631
1
7월 16
7419
1
7월 15
8580