i have master data model contains a lot of items and i called it in product.template
i need to make tow fields on master data model (factor, suggeted_price)
i make the factor is Float as percentage and suggested_price is computed field that equal (factor * product.template.standard_price)
class cars(models.Model):
_name = 'cars'
@api.one
@api.depends('factor',)
def car_price(self):
if self.factor:
self.suggeted_price = self.factor * self.product.template.standard_price
pass
factor = fields.Float(string="", required=False, )
suggeted_price = fields.Float(string="", required=False, compute=car_price )
i get error 'cars' object has no attribute 'product' that's actually what i expected
i need from you to help me on how make the computed field suggested_price get it's value only when i open product form and chose it's car record then calculate itself from self.factor and self.standard_price(which on product form)