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

Hi,

I'm trying to make the "Cost" field show the last price we purchased products for. In other words, as new POs are made, costs are automatically updated. 

Any ideas?

Thanks

อวตาร
ละทิ้ง

where do i put this code?

คำตอบที่ดีที่สุด

Hi,

You can inherit the purchase.order model and add the code to change the price of the product in the button_confirm function.


Please refer the code given below:


_inherit = "purchase.order"


def button_confirm(self):

   for rec in self.order_line:

      rec.product_id.standard_price = rec.price_unit

   return super().button_confirm()



Hope it helps

อวตาร
ละทิ้ง