How to correct error in my code :
from odoo import models, fields, api
class HomeMarketProduct(models.Model):
_inherit = 'product.template'
ProductUrl = fields.Char(string='Product Url', store=True)
Discount = fields.Float(string='Discount', compute='_computed_price', store=True)
@api.depends('list_price', 'compare_list_price')
def _computed_price(self):
for record in self:
if record.compare_list_price:
record.Discount = ((record.compare_list_price - record.list_price) / record.compare_list_price) * 100
else:
record.Discount = 0
error:
ValueError: Wrong @depends on '_computed_price' (compute method of field product.template.Discount). Dependency field 'compare_list_price' not found in model product.template.
Although there is a field inside product.template