fix error al crear producto sin tener ninguna cateegoría pública definida

This commit is contained in:
santiky 2022-04-22 19:07:07 +02:00
parent 3a0a965589
commit 50f2a6d592
Signed by: snt
GPG key ID: A9FD34930EADBE71

View file

@ -16,7 +16,8 @@ class ProductProduct(models.Model):
#check if there are public categories setup by user
new_cats = []
old_cats = vals.get("public_categ_ids")
if old_cats[0][2]:
if old_cats:
if old_cats[0][2]:
for i in old_cats[0][2]:
new_cats.append(i)
category = self.env['product.category'].browse(categ_id)