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

The changes made in create and write of inherited res_partner should affect only the customer and not the supplier and user.

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

Hi,

There is only one object "res.partner" which manage customer and supplier.

Email : info@acespritech.com
Skype : acespritech
Blog : acespritechblog.wordpress.com

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

Customer, supplier and user (and maybe other 'persons') use the same model 'res.partner'. In order for your model to only do something different for customer, you should ask in your write and your create, if the res.partner you are in, is a customer.

Some quick and dirty code:

def create(.....):
    partner = pool.get(id)
    if partner.is_customer and not partner.supplier:
        do your code here
    else:
        res = super(self, res.partner).create(.....)

The same goes for write.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 17
9440
0
thg 10 24
982
2
thg 1 16
35711
0
thg 3 15
4684
2
thg 3 15
5603