Paulius 5 months ago
committed by GitHub
parent
commit
8636ce33f2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      hide_menu_user/models/res_users.py

10
hide_menu_user/models/res_users.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import fields, models from odoo import fields, models, Command
class ResUsers(models.Model): class ResUsers(models.Model):
@ -30,14 +30,14 @@ class ResUsers(models.Model):
def write(self, vals): def write(self, vals):
""" """
Write method for the ResUsers model. Write method for the ResUsers model.
Ensure the menu will not remain hidden after removing it from the list. Ensure the menu will not remain hidden after removing it from the list.
""" """
res = super(ResUsers, self).write(vals) res = super(ResUsers, self).write(vals)
for record in self: for record in self:
for menu in record.hide_menu_ids: for menu in record.hide_menu_ids:
menu.write({ menu.write({
'restrict_user_ids': [fields.Command.link(record.id)] 'restrict_user_ids': [Command.set([record.id] + [user.id for user in menu.restrict_user_ids])]
}) })
return res return res

Loading…
Cancel
Save