Skip to content

Commit

Permalink
[IMP]Product_profile: Support Create multi
Browse files Browse the repository at this point in the history
Fixes the warning "The model odoo.addons.product_profile is not overriding the create method in batch"

Fixup! Update product_profile
  • Loading branch information
bosd committed Sep 30, 2024
1 parent 61beccc commit 9355863
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions product_profile/models/product_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ def _onchange_from_profile(self):
except Exception as e:
raise UserError(format_except_message(e, field, self)) from e

@api.model
def create(self, vals):
if vals.get("profile_id"):
vals.update(self._get_vals_from_profile(vals, ignore_defaults=False))
return super().create(vals)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get("profile_id"):
vals.update(self._get_vals_from_profile(vals, ignore_defaults=False))

Check warning on line 219 in product_profile/models/product_profile.py

View check run for this annotation

Codecov / codecov/patch

product_profile/models/product_profile.py#L219

Added line #L219 was not covered by tests
return super().create(vals_list)

def write(self, vals):
profile_changed = vals.get("profile_id")
Expand Down

0 comments on commit 9355863

Please sign in to comment.