I want to do some actions for every new created product.
In order to do that I need the product_id of the freshly new generated product.
I know that I can extend the create method of product.template as in:
class AdditionalActionsOnProductCreation ( models.Model )
_inherit = 'product.template'
@api.model
def create(self, vals):
....
# Creates the product using standard create metho
new_product_template = super(AdditionalActionsOnProductCreation, self).create(vals
# Try to add the product_id and assign to ean13 field (just to test/see it easily)
new_product_template.update({'ean13': new_product_template.product_id})
return new_product_template
But product_id is not there, where should i retrieve it?