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

i have module which has three field.name,firstname and lastname,when user save it firstname and lastname

concatenate in name field,here name field must be readonly mod.

아바타
취소
베스트 답변

Hello Vijay,

This will help you.

name = fields.Char(compute='_compute_name', store="True")
firstname = fields.Char()
lastname = fields.Char()

@api.depends('firstname', 'lastname')
def _compute_name(self):
    for record in self:
        record.name = record.firstname + record.lastname

아바타
취소
베스트 답변

Hello, I think you've three options.

- Overriding the create and write functions.

-Use onchange method in the firstname and lastname: but if you used onchange method to modify a readonly field this will not update the field in DB, so you need to make an invisible field, as workaround.

-Make the name field as a functional field.

아바타
취소
작성자

how to make name as functional field any demo function?

관련 게시물 답글 화면 활동
1
10월 24
3812
9
7월 21
63198
8
11월 19
7894
8
4월 25
29082
3
8월 24
16049