コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
1706 ビュー

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




アバター
破棄
著作者 最善の回答

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!


アバター
破棄
関連投稿 返信 ビュー 活動
1
1月 25
1282
0
12月 24
1284
1
5月 24
2689
2
12月 24
15089
2
5月 22
14596