Вот моя функция создания:
@api.model
def create(self, vals):
res = super(GroupsalesGroupsales, self).create(vals)
main_category = self.env['product.category'].search([])
if main_category:
main_category = main_category[0]
self.env['product.template'].create({'name': vals['name'],
'categ_id': main_category.id,
'list_price':vals['prix_rabais'],
'default_code': 'GS-PROD',
'image_small' : vals['image_small'], })
return res