CybroOdoo / CybroAddons

281 stars 641 forks source link

Update create method overwrite in hide_menu_user (res.user) #279

Closed markuskirch closed 1 year ago

markuskirch commented 1 year ago

The module throws an error in the logs, because in Odoo 16 the re.users model uses batch creation of records:

The model odoo.addons.hide_menu_user.models.res_user is not overriding the create method in batch

Steps to fix:

  1. Added correct decorator "@api.model_create_multi"
  2. renamed parameter "vals" to "vals_list" to emphasize that it is a list of vals for a list of records to be created
  3. Ususally, one would loop over vals_list (for vals in vals_list), but no modifications to vals are done here, to it so it is not necessary in this case.
markuskirch commented 1 year ago

@AjmalCybro please review.

We are using this module in our Odoo environment, and it throws an error because the new Odoo16 decorator "@api.model_create_multi" decorator is required for res.user inheritance.

I fixed the issue for you.

Cheers

CybroOdoo commented 1 year ago

@jiaulislam @markuskirch

Thanks for the update. Will review and update soon.