I've created a module in Odoo 10 with the following code to inherit the product.product
model and override the existing standard_price
field definition to set it as a compute field:
class ProductProduct(models.Model):
_inherit = 'product.product'
standard_price = fields.Float(
'Cost', company_dependent=True,
digits=dp.get_precision('Product Price'),
groups="base.group_user",
compute='_compute_set_standard_price')
def _compute_set_standard_price(self):
.....
# calculation for the value
.....
self.standard_price = 121 #this value is an example
The standard_price
would be set to 121 because I've override the field definition to a compute field but the standard_price
field is set to 0 and don't trigger the compute method. This code in Odoo v8 works fine.
What's the way to override an existing field difinition in a inherited model?