Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4864 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

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

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ค. 17
9425
0
ต.ค. 24
978
update fields on write() method แก้ไขแล้ว
2
ม.ค. 16
35706
0
มี.ค. 15
4679
2
มี.ค. 15
5600