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

Hello, I've been following the documentation on creating custom modules and I'm stuck at chapter 10: \https://www.odoo.com/documentation/15.0/developer/howtos/rdtraining/10_actions.html 


I can't figure out how to achieve the 3rd point:

  • When an offer is accepted, set the buyer and the selling price for the corresponding property.

    Refer to the third image of the Goal for the expected result.

    Pay attention: in real life only one offer can be accepted for a given property!

How am I supposed to set the selling price and the buyer when offer is accepted? I tried to use onchange method on the property models that track based on its offer_ids, but it's not setting the selling price. How should I set the selling price and the buyer?

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

Hello,

There is a connection field between the one2many field of offer and main model properties, "property_id".using this field you can set the selling price and buyer in offer model as like this.

def button_accept(self): 
self.status = 'accept' 
self.property_id.selling_price = self.price 
self.property_id.buyer_id = self.partner_id.id

Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.พ. 16
4556
How do I create new modules in Odoo? แก้ไขแล้ว
2
ธ.ค. 21
3284
0
พ.ค. 21
4036
2
มี.ค. 15
8714
0
มี.ค. 25
1382