Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1709 Lượt xem

Might be a silly question and I apologize in advance. 


Wondering how to do this or if it is even possible


So I have :


field1 = field.char


field2 = field.char

field3 = field.char

I want field1 to populate onchange of field2 and field3 separated by a "-"

Fields are in the same form and the same model.

example

Name(field1): John - Smith

First name(field2): John

Last name(field3): Smith




Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Sorry I think I figured it out but would appreciate feedback


@api.depends('firstname', 'lastname')
def _compute_full_name(self):
for record in self:
record.full_name = str(record.firstname) + "-" + str(record.lastname)

if this is not appropriate please let me know 


thank you!


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 25
1285
0
thg 12 24
1290
1
thg 5 24
2692
2
thg 12 24
15093
2
thg 5 22
14599