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

Hi Community,

How can i change the default _rec_name of the model account.invoice using name_get or any other possible ways.How can i achieve this.I have tried inheriting the account.invoice and gave my new field as _rec_name but it dont works for me.

Thanks in advance

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks Waleed Mohsen its worked for me

Câu trả lời hay nhất

Hi, 

in COA, Let suppose you want to return account.code + ' ' + account.name rather than default name so you will override name_get method as below:

@api.multi
@api.depends('name', 'code')
def name_get(self):
result = []
for account in self:
name = account.code + ' ' + account.name
result.append((account.id, name))
return result
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 24
4960
0
thg 11 19
4936
5
thg 8 19
11471
2
thg 4 24
17060
3
thg 12 23
7160