Skip to content

Commit

Permalink
[FIX] Change model_create_single decorator to multi
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino authored and OCA-git-bot committed Jul 3, 2024
1 parent 2e88f6b commit b26a73d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pos_disable_product_variant/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ class ProductProduct(models.Model):
)
template_in_pos = fields.Boolean(related="product_tmpl_id.available_in_pos")

@api.model_create_single
def create(self, vals):
product = super().create(vals)
if "available_in_pos" not in vals:
product.available_in_pos = product.product_tmpl_id.available_in_pos
return product
@api.model_create_multi
def create(self, vals_list):
products = super().create(vals_list)
for product, vals in zip(products, vals_list):
if "available_in_pos" not in vals:
product.available_in_pos = product.product_tmpl_id.available_in_pos
return products


class ProductTemplate(models.Model):
Expand Down

0 comments on commit b26a73d

Please sign in to comment.