In purchase order line i need to show the list_price of the product but that have a condition, today(may 30) if i make a purchase then the list_price is 100 will shown and after confirming the purchase if i change the list_price to 120 in the purchase it still needs to show 100 for that i have create a function with api.onchange()
It works well,
but if i create a replenish with buy it creates a purchase order in that order the list_price is not updating
below is my onchange code
class PurchaseOrderInherit(models.Model):
_inherit = 'purchase.order.line'
mrp = fields.Float("MRP", help="Load from Product MRP(Latest)", digits='Product Price')
@api.onchange('product_template_id', 'product_id')
def _compute_mrp(self):
for rec in self:
if rec.product_id:
rec.mrp = rec.product_id.list_price
else:
rec.mrp = False
Kindly help me
NOTE : I have enabled purchase_product_matrix this module it will create product_template_id in po_order_line