Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
7467 Представления

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
6226
1
июн. 15
5094
1
мая 21
10663
1
июл. 16
7451
1
июл. 15
8619