Good day everyone. I'm trying to override write in product class to replace the value of a field when user saves.
class ProductProduct(models.Model):_inherit = 'product.product'
def write(self, vals):
res = super(ProductProduct, self).write(vals)
self.description_sale = res.part_number
return res
Could anyone please point me the proper sintax? thanks in advance.
Hello Avash,
The write method returns a Boolean and not a recordset/object. If you are trying to achieve set the description_sale value the sale as the part_number field. You can try:
self.description_sale = self.part_number
Could you provide more info on what you are trying to do, please.
Your code looks ok in terms of overriding.
Thanks,