I have override create() method in my product_product and product_template class. When I use view with model product.product and try to create new record (new product) by pressing Save, both create() methods are called: first in product_product then in product_template. This causes a problem because of the different vals values. I expected only product_product create() to be called. Here is the code snippet:
class product_product(osv.Model):
_inherit = 'product.product'
def create(self, cr, uid, vals, context=None):
# ... validation code
return super(product_product, self).create(cr, uid, vals, context=context)
class product_template(osv.Model):
_inherit = 'product.template'
def create(self, cr, uid, vals, context=None):
# ... validation code
return super(product_template, self).create(cr, uid, vals, context=context)
product_tmpl_id
), so if you don't provide it with an existing template it has to create a new one. – Ludwik Trammer