diff --git a/menu_lock/README.rst b/menu_lock/README.rst new file mode 100644 index 000000000..b59947d89 --- /dev/null +++ b/menu_lock/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Menu Lock in Odoo +================ +This module helps to lock menu items in odoo. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License, Version 3 (AGPL v3). +(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) + +Credits +------- +* Developer: Jumana@cybrosys + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ + + diff --git a/menu_lock/__init__.py b/menu_lock/__init__.py new file mode 100644 index 000000000..1df5341c4 --- /dev/null +++ b/menu_lock/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Jumana J() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models diff --git a/menu_lock/__manifest__.py b/menu_lock/__manifest__.py new file mode 100644 index 000000000..1b2a40481 --- /dev/null +++ b/menu_lock/__manifest__.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Jumana J() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Menu Lock in Odoo', + 'version': '16.0.1.0.0', + 'summary': """This Module will help to lock all the menu items""", + 'description': """User can choose the menus and set the password for lock + them""", + 'category': 'Extra Tools', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'images': ['static/description/banner.jpg'], + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'web', 'contacts'], + 'data': [ + 'security/ir.model.access.csv', + 'views/res_users_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'menu_lock/static/src/js/lock_action.js', + 'menu_lock/static/src/xml/menu_lock.xml', + 'menu_lock/static/src/css/menu_lock.css', + ], + }, + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/menu_lock/doc/RELEASE_NOTES.md b/menu_lock/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..b8c014c54 --- /dev/null +++ b/menu_lock/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 01.07.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial commit for Menu Lock in Odoo \ No newline at end of file diff --git a/menu_lock/models/__init__.py b/menu_lock/models/__init__.py new file mode 100644 index 000000000..80799170b --- /dev/null +++ b/menu_lock/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Jumana J() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import res_users +from . import menu_password diff --git a/menu_lock/models/menu_password.py b/menu_lock/models/menu_password.py new file mode 100644 index 000000000..8444d0d16 --- /dev/null +++ b/menu_lock/models/menu_password.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Jumana J() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +"""Menu Password""" +from odoo import fields, models + + +class MenuPassword(models.Model): + """Inverse model for one to many field of the model res users""" + _name = 'menu.password' + _description = 'Menus and Corresponding Locks for multiple password lock ' \ + 'conditions' + + menus_id = fields.Many2one('ir.ui.menu', string="Menus", + help='Select the menus to lock', + domain="[('parent_id','=',False)]") + password = fields.Char(string='Login Password', + help='Lock Password') + password_id = fields.Many2one('res.users', string='Password', + help='Inverse field to res user model') diff --git a/menu_lock/models/res_users.py b/menu_lock/models/res_users.py new file mode 100644 index 000000000..bfff84cb2 --- /dev/null +++ b/menu_lock/models/res_users.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Jumana J() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +"""Res Users Inherit""" +from odoo import api, fields, models + + +class ResUsers(models.Model): + """Inherited the res_users model for adding the fields for menu lock + setup.""" + _inherit = 'res.users' + + password_lock = fields.Selection( + [('single_password', 'Single Password Lock'), + ('multi_password', 'Multi Password Lock')], + string='Menu Lock Password Type', + help='Type of Menu Lock Password') + login_password = fields.Char(string='Login Password', help='Login Password') + menus_to_lock_ids = fields.Many2many('ir.ui.menu', string="Menus to lock", + domain="[('parent_id','=',False)]", + help='Select the menus to lock') + multi_lock_ids = fields.One2many('menu.password', 'password_id', + string='Multi menus to lock', + help='Multi lock menus and password') + + @api.model + def menu_lock_search(self, args): + """Method to returning values though args""" + user = self.env['res.users'].browse(args[0]) + return { + 'multi_lock_ids': [{ + 'id': menu.menus_id.id, + 'password': menu.password + } for menu in user.multi_lock_ids] + } + + @api.onchange('menus_to_lock_ids') + def _onchange_menus_to_lock_ids(self): + """Method to add fields from single password option to one-to-many of + multi password with same password in onchange of the field""" + if self.password_lock == 'single_password': + new_lines = [(5, 0, 0)] + for rec in self.menus_to_lock_ids: + new_lines.append( + (0, 0, {'menus_id': rec._origin.id, + 'password': self.login_password, + })) + self.write({'multi_lock_ids': new_lines}) diff --git a/menu_lock/security/ir.model.access.csv b/menu_lock/security/ir.model.access.csv new file mode 100644 index 000000000..4e9a92fe0 --- /dev/null +++ b/menu_lock/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_menu_password,access_menu_password,model_menu_password,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/menu_lock/static/description/assets/icons/check.png b/menu_lock/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/menu_lock/static/description/assets/icons/check.png differ diff --git a/menu_lock/static/description/assets/icons/chevron.png b/menu_lock/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/menu_lock/static/description/assets/icons/chevron.png differ diff --git a/menu_lock/static/description/assets/icons/cogs.png b/menu_lock/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/menu_lock/static/description/assets/icons/cogs.png differ diff --git a/menu_lock/static/description/assets/icons/consultation.png b/menu_lock/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/menu_lock/static/description/assets/icons/consultation.png differ diff --git a/menu_lock/static/description/assets/icons/ecom-black.png b/menu_lock/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/menu_lock/static/description/assets/icons/ecom-black.png differ diff --git a/menu_lock/static/description/assets/icons/education-black.png b/menu_lock/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/menu_lock/static/description/assets/icons/education-black.png differ diff --git a/menu_lock/static/description/assets/icons/hotel-black.png b/menu_lock/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/menu_lock/static/description/assets/icons/hotel-black.png differ diff --git a/menu_lock/static/description/assets/icons/license.png b/menu_lock/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/menu_lock/static/description/assets/icons/license.png differ diff --git a/menu_lock/static/description/assets/icons/lifebuoy.png b/menu_lock/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/menu_lock/static/description/assets/icons/lifebuoy.png differ diff --git a/menu_lock/static/description/assets/icons/logo.png b/menu_lock/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/menu_lock/static/description/assets/icons/logo.png differ diff --git a/menu_lock/static/description/assets/icons/manufacturing-black.png b/menu_lock/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/menu_lock/static/description/assets/icons/manufacturing-black.png differ diff --git a/menu_lock/static/description/assets/icons/pos-black.png b/menu_lock/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/menu_lock/static/description/assets/icons/pos-black.png differ diff --git a/menu_lock/static/description/assets/icons/puzzle.png b/menu_lock/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/menu_lock/static/description/assets/icons/puzzle.png differ diff --git a/menu_lock/static/description/assets/icons/restaurant-black.png b/menu_lock/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/menu_lock/static/description/assets/icons/restaurant-black.png differ diff --git a/menu_lock/static/description/assets/icons/service-black.png b/menu_lock/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/menu_lock/static/description/assets/icons/service-black.png differ diff --git a/menu_lock/static/description/assets/icons/trading-black.png b/menu_lock/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/menu_lock/static/description/assets/icons/trading-black.png differ diff --git a/menu_lock/static/description/assets/icons/training.png b/menu_lock/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/menu_lock/static/description/assets/icons/training.png differ diff --git a/menu_lock/static/description/assets/icons/update.png b/menu_lock/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/menu_lock/static/description/assets/icons/update.png differ diff --git a/menu_lock/static/description/assets/icons/user.png b/menu_lock/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/menu_lock/static/description/assets/icons/user.png differ diff --git a/menu_lock/static/description/assets/icons/wrench.png b/menu_lock/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/menu_lock/static/description/assets/icons/wrench.png differ diff --git a/menu_lock/static/description/assets/modules/module01.png b/menu_lock/static/description/assets/modules/module01.png new file mode 100644 index 000000000..a9936f593 Binary files /dev/null and b/menu_lock/static/description/assets/modules/module01.png differ diff --git a/menu_lock/static/description/assets/modules/module02.png b/menu_lock/static/description/assets/modules/module02.png new file mode 100644 index 000000000..1a9e2cbd7 Binary files /dev/null and b/menu_lock/static/description/assets/modules/module02.png differ diff --git a/menu_lock/static/description/assets/modules/module03.png b/menu_lock/static/description/assets/modules/module03.png new file mode 100644 index 000000000..d3d28e08b Binary files /dev/null and b/menu_lock/static/description/assets/modules/module03.png differ diff --git a/menu_lock/static/description/assets/modules/module04.png b/menu_lock/static/description/assets/modules/module04.png new file mode 100644 index 000000000..5297b364a Binary files /dev/null and b/menu_lock/static/description/assets/modules/module04.png differ diff --git a/menu_lock/static/description/assets/modules/module05.png b/menu_lock/static/description/assets/modules/module05.png new file mode 100644 index 000000000..2263f673e Binary files /dev/null and b/menu_lock/static/description/assets/modules/module05.png differ diff --git a/menu_lock/static/description/assets/modules/module06.png b/menu_lock/static/description/assets/modules/module06.png new file mode 100644 index 000000000..0b8c68699 Binary files /dev/null and b/menu_lock/static/description/assets/modules/module06.png differ diff --git a/menu_lock/static/description/assets/screenshots/ML-001.png b/menu_lock/static/description/assets/screenshots/ML-001.png new file mode 100644 index 000000000..3b331250b Binary files /dev/null and b/menu_lock/static/description/assets/screenshots/ML-001.png differ diff --git a/menu_lock/static/description/assets/screenshots/ML-002.png b/menu_lock/static/description/assets/screenshots/ML-002.png new file mode 100644 index 000000000..05df9dee9 Binary files /dev/null and b/menu_lock/static/description/assets/screenshots/ML-002.png differ diff --git a/menu_lock/static/description/assets/screenshots/ML-003.png b/menu_lock/static/description/assets/screenshots/ML-003.png new file mode 100644 index 000000000..b4cc6d70b Binary files /dev/null and b/menu_lock/static/description/assets/screenshots/ML-003.png differ diff --git a/menu_lock/static/description/assets/screenshots/hero.gif b/menu_lock/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..c5c504bcc Binary files /dev/null and b/menu_lock/static/description/assets/screenshots/hero.gif differ diff --git a/menu_lock/static/description/banner.jpg b/menu_lock/static/description/banner.jpg new file mode 100644 index 000000000..e6d89aaa2 Binary files /dev/null and b/menu_lock/static/description/banner.jpg differ diff --git a/menu_lock/static/description/icon.png b/menu_lock/static/description/icon.png new file mode 100644 index 000000000..dbfe3beb1 Binary files /dev/null and b/menu_lock/static/description/icon.png differ diff --git a/menu_lock/static/description/index.html b/menu_lock/static/description/index.html new file mode 100644 index 000000000..d19ca640f --- /dev/null +++ b/menu_lock/static/description/index.html @@ -0,0 +1,669 @@ +
+ + +
+
+
+ +
+
+
+ Community +
+ +
+
+
+
+ + + +
+
+
+

+ Menu Lock in Odoo

+

+ Menu Lock in Odoo +

+ + + +
+
+ + + + + + + +
+
+

+ Overview +

+
+ +
+

+ This module helps to lock the menus, that is user can only enter into the module after login. + User can select the menus and lock them, both single password and multi password options are + provided ,if the user chooses single password option, then all ath menus selected will be unlocked + with same password. if user chooses multiple password option , then user can secure each menu with different + passwords. +

+ +
+
+ + + +
+
+

+ Configuration +

+
+ +
+

+ No additional configuration required

+ +
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Community Support

+

+ Available in Odoo 16.0 Community.

+
+
+ +
+
+ +
+
+

+ User can select the menus to lock.

+

+ User can choose the menus and set the password for lock them.

+
+
+
+
+ +
+
+

+ Single and Multi password options.

+

+ User can choose the single or multiple password options for lock the menus.

+
+
+
+
+ +
+
+

+ Single Password Menu Lock.

+

+ Single Password for all the selected menus.

+
+
+
+
+ +
+
+

+ Multiple Password Menu Lock.

+

+ Different Passwords for all selected menus.

+
+
+ +
+ + + +
+
+

+ Screenshots +

+
+
+

+ User can select the type of menu lock, single or multiple.

+

+ We can lock more menus with single password. +

+ +
+ +
+

+ Multiple Menus with different passwords.

+

+ We can lock multiple menus with different passwords . +

+ +
+ +
+

+ Menu Lock on choosing the lock enabled menus

+

+ On confirming if password matches it will open the menu otherwise shows error warning. +

+ + +
+ + +
+ + + +
+
+

Suggested Products

+
+ + +
+
+ + + +
+
+
+

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+ +
+
+ + + + + +
+
+
+

Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/menu_lock/static/src/css/menu_lock.css b/menu_lock/static/src/css/menu_lock.css new file mode 100644 index 000000000..420b9fc5d --- /dev/null +++ b/menu_lock/static/src/css/menu_lock.css @@ -0,0 +1,27 @@ +.link-style{ + width: 400px; + height: 55px; + font-size: 20px; + border-color: black; + border-width: 1.5px; + margin-left: 100px; + margin-top: 4px; + } +.col-form-label { + padding-top: calc(0.375rem + 1px); + padding-bottom: calc(0.375rem + 1px); + margin-bottom: 0; + font-size: 20px; + line-height: 1.5; + color: black; + } +i.fa.fa-eye{ + padding-left:350px; + font-size:20px; + +} +.toggle_eye{ + position: absolute; + right: 100px; + top: 17px; +} diff --git a/menu_lock/static/src/js/lock_action.js b/menu_lock/static/src/js/lock_action.js new file mode 100644 index 000000000..ff28db219 --- /dev/null +++ b/menu_lock/static/src/js/lock_action.js @@ -0,0 +1,82 @@ +/** @odoo-module **/ +import { Component, useState, mount } from "@odoo/owl"; +import { DropdownItem } from "@web/core/dropdown/dropdown_item"; +import { patch } from "@web/core/utils/patch"; +var Dialog = require('web.Dialog'); +var core = require('web.core'); +var QWeb = core.qweb; +var rpc = require('web.rpc'); +var _t = core._t; + +//patching the menu items +patch(DropdownItem.prototype, "menu_lock", { + //onclick function of menu item + async onClick(ev) { + var _super = this._super; + ev.preventDefault() + var session = require('web.session'); + var userId = session.uid; + var currentMenu = this.props.dataset.section + //rpc query to get values about password lock from res.users + await rpc.query({ + model: 'res.users', + method: 'menu_lock_search', + args: [ + [userId] + ], + }).then(function(data) { + //checking the current menu in menus to lock + var menu = data.multi_lock_ids.filter(obj => { + return parseInt(obj.id) === parseInt(currentMenu) + }) + //if current menu is lock menu + if (menu.length != 0 && menu[0].id && menu[0].password) { + //Open dialog box to login + var dialog = new Dialog(this, { + title: "Menu Security PIN", + $content: $(QWeb.render('menuLockPopup', { + role: 'alert', + })), + size: 'medium', + buttons: [{ + text: _t("confirm"), + classes: 'btn-primary check_password', + click: false, + }, + { + text: _t("Cancel"), + close: true + }, + ], + }); + dialog.opened().then(() => { + //show and hide the password on click of eye icon. + dialog.$el.find('.toggle_eye').click(function(){ + var securityPin = dialog.$el.find('#password')[0]; + if (securityPin.type === "password") { + securityPin.type = "text"; + } else { + securityPin.type = "password"; + } + }) + //dialog box confirm button function, if matches + //successfully logins to the menu, otherwise show error warning. + dialog.buttons[0].click = function(event) { + var current_pwd = dialog.$el.find('#password').val() + //if password matches close the modal and enter into the + //model + if (current_pwd == menu[0].password) { + dialog.close(); + _super(ev); + } else { + dialog.$el.find('#wrong_password_alert').show(); + } + }; + }); + dialog.open(); + } else { + _super(ev); + } + }) + }, +}); \ No newline at end of file diff --git a/menu_lock/static/src/xml/menu_lock.xml b/menu_lock/static/src/xml/menu_lock.xml new file mode 100644 index 000000000..c5d7914f4 --- /dev/null +++ b/menu_lock/static/src/xml/menu_lock.xml @@ -0,0 +1,35 @@ + + + + + diff --git a/menu_lock/views/res_users_views.xml b/menu_lock/views/res_users_views.xml new file mode 100644 index 000000000..98d724c59 --- /dev/null +++ b/menu_lock/views/res_users_views.xml @@ -0,0 +1,33 @@ + + + + + res.users.view.form.inherit.menu.lock + res.users + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file