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

Hello,

I've added a custom field in res.partner model that is [x_branch].

In Sales/Quotations when user want to create new Sale Order. I want the customer dropdown list to show "name #branch" instead of just name. For example, a customer name "VendorABC" with branch "4" should be display as "VendorABC #0004" in dropdown list.

How can i achieve this?

Thanks.

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

Hi,

What you can do is that rewrite the existing name_get function of the res.partner model if it exists, if not inherit the res.partner model and write the name_get function.

Inside this function you can add the branch name along with the partner name, what you return from this function will be shown in the drop down list of this model.


See a sample,



Thanks

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

@Niyas, Thanks for some direction I see a  "def name_get(self): " in res_partner.py now.

Another question. in case of inheriting res.partner model. I do need to change partner_id in the view "sale.order.form" to refer to this new inherited model too, is that correct? And how can I do this.

Ảnh đại diện
Huỷ bỏ

No need to change the partner_id field

Tác giả

Thanks for answer, I got some idea now :)

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 5 18
6673
1
thg 8 18
3603
3
thg 2 25
1834
1
thg 12 24
2021
2
thg 3 24
2365