diff --git a/user_audit/README.rst b/user_audit/README.rst new file mode 100755 index 000000000..83f51b755 --- /dev/null +++ b/user_audit/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +User Activity Audit +==================== +Track user's all type of activities like create,write,read etc + +Configuration +============= +Enable security group for the user under user audit section in user. +select either Manager or User + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +Developer: (V16) Sreeshanth V S, Contact: odoo@cybrosys.com + +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/user_audit/__init__.py b/user_audit/__init__.py new file mode 100755 index 000000000..18e23feba --- /dev/null +++ b/user_audit/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models +from . import wizard diff --git a/user_audit/__manifest__.py b/user_audit/__manifest__.py new file mode 100755 index 000000000..b983bdbad --- /dev/null +++ b/user_audit/__manifest__.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': "User Activity Audit", + "version": "16.0.1.0.0", + "summary": "Tracking user's create, write, read activities", + "description": "This module helps you to track user's all type of " + "activities like create, write, read etc on various models " + "and records in all users", + "category": "Extra Tools", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['web'], + 'data': [ + 'security/user_audit_groups.xml', + 'security/ir.model.access.csv', + 'data/user_audit_data.xml', + 'views/user_audit_log_views.xml', + 'views/user_audit_views.xml', + 'wizard/clear_user_log_views.xml', + 'views/user_audit_menus.xml' + ], + 'assets': + { + 'web.assets_backend': [ + 'user_audit/static/src/js/list_controller.js', + 'user_audit/static/src/js/form_controller.js' + ]}, + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True +} + diff --git a/user_audit/data/user_audit_data.xml b/user_audit/data/user_audit_data.xml new file mode 100755 index 000000000..62363cb10 --- /dev/null +++ b/user_audit/data/user_audit_data.xml @@ -0,0 +1,10 @@ + + + + + Sequence + user.audit.log + TA + 2 + + \ No newline at end of file diff --git a/user_audit/doc/RELEASE_NOTES.md b/user_audit/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..a8d9fa485 --- /dev/null +++ b/user_audit/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 24.07.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial commit for User Activity Audit diff --git a/user_audit/models/__init__.py b/user_audit/models/__init__.py new file mode 100755 index 000000000..244c7d912 --- /dev/null +++ b/user_audit/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import user_audit_log +from . import user_audit diff --git a/user_audit/models/user_audit.py b/user_audit/models/user_audit.py new file mode 100755 index 000000000..676b08db5 --- /dev/null +++ b/user_audit/models/user_audit.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class UserAudit(models.Model): + """We can manage user audit configuration.We can add user + model etc. which are to track""" + _name = "user.audit" + _description = "User Audit Log Configuration" + + name = fields.Char(required=True, string="Name", help="Name of the log") + is_read = fields.Boolean(string="Read", + help="Enabling we can track all read activities " + "It will track all your read activity that " + "may increase the size of the log that may " + "cause some problem with your data base") + is_write = fields.Boolean(string="Write", + help="Enabling we can track all write activities") + is_create = fields.Boolean(string="Create", + help="Enabling we can track all create activities") + is_delete = fields.Boolean(string="Delete", + help="Enabling we can track all delete activities") + is_all_users = fields.Boolean(string="All Users", + help="Enabling we can track activities of all users") + user_ids = fields.Many2many('res.users', string="Users", + help="Manage users") + model_ids = fields.Many2many('ir.model', string="Model", + help='Used to select which model is to track') + + @api.model + def create_audit_log_for_create(self, res_model): + """ Used to create user audit log based on the create operation """ + model_id = self.env['ir.model'].search([('model', '=', res_model)]).id + audit = self.search([('model_ids', 'in', model_id)]) + if audit and audit.is_create: + self.env['user.audit.log'].create({ + 'user_id': self.env.user.id, + 'model_id': model_id, + 'operation_type': 'create', + 'date': fields.Datetime.now() + }) + return res_model + + @api.model + def create_audit_log_for_read(self, res_model, record_id): + """ Used to create user audit log based on the read operation """ + model_id = self.env['ir.model'].search([('model', '=', res_model)]).id + audit = self.search([('model_ids', 'in', model_id)]) + if audit and audit.is_read: + self.env['user.audit.log'].create({ + 'user_id': self.env.user.id, + 'model_id': model_id, + 'record': record_id, + 'operation_type': 'read', + 'date': fields.Datetime.now() + }) + return res_model + + @api.model + def create_audit_log_for_delete(self, res_model, record_id): + """ Used to create user audit log based on the delete operation """ + model = self.env['ir.model'].search([('model', '=', res_model)]) + model_id = self.env[res_model].browse(record_id) + audit = self.search([('model_ids', 'in', model.id)]) + if audit and audit.is_delete and record_id and model_id: + self.env['user.audit.log'].create({ + 'user_id': self.env.user.id, + 'model_id': model.id, + 'record': record_id, + 'operation_type': 'delete', + 'date': fields.Datetime.now() + }) + return res_model + + @api.model + def create_audit_log_for_write(self, res_model, record_id): + """ Used to create user audit log based on the write operation """ + model_id = self.env['ir.model'].search([('model', '=', res_model)]).id + audit = self.search([('model_ids', 'in', model_id)]) + if audit and audit.is_write: + self.env['user.audit.log'].create({ + 'user_id': self.env.user.id, + 'model_id': model_id, + 'record': record_id, + 'operation_type': 'write', + 'date': fields.Datetime.now() + }) + return res_model diff --git a/user_audit/models/user_audit_log.py b/user_audit/models/user_audit_log.py new file mode 100755 index 000000000..2571380b5 --- /dev/null +++ b/user_audit/models/user_audit_log.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class UserAuditLogs(models.Model): + """ For tracking user activity by adding user logs """ + _name = "user.audit.log" + _description = "User Audit Details" + + name = fields.Char(string="Reference", required=True, readonly=True, + default='New', help="For getting reference") + user_id = fields.Many2one('res.users', string="User", + help="For getting user") + record = fields.Integer(string="Record ID", + help="For getting which record has accessed") + model_id = fields.Many2one('ir.model', string="Object", + help="For getting which model has accessed") + operation_type = fields.Selection(selection=[('read', 'Read'), + ('write', 'Write'), + ('create', 'Create'), + ('delete', 'Delete')], + string="Type", + help="For getting which operation has been performed") + date = fields.Datetime(string="Date", + help="For getting which time the operation has done") + + @api.model_create_multi + def create(self, values): + """ For adding sequence number """ + vals = values[0] + if vals.get('name', 'New'): + vals['name'] = self.env['ir.sequence'].next_by_code( + 'user.audit.log') + res = super(UserAuditLogs, self).create(vals) + return res diff --git a/user_audit/security/ir.model.access.csv b/user_audit/security/ir.model.access.csv new file mode 100755 index 000000000..29f0d412c --- /dev/null +++ b/user_audit/security/ir.model.access.csv @@ -0,0 +1,6 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_user_audit_log_manager,access.user.audit.log.manager,model_user_audit_log,user_audit.user_audit_log_group_manager,1,1,1,1 +access_user_audit_log_user,access.user.audit.log.user,model_user_audit_log,user_audit.user_audit_log_group_user,1,0,0,0 +access_user_audit_manager,access.user.audit,model_user_audit,user_audit.user_audit_log_group_manager,1,1,1,1 +access_user_audit_user,access.user.audit,model_user_audit,user_audit.user_audit_log_group_user,1,0,0,0 +access_clear_user_log_manager,access.clear.user.log,model_clear_user_log,user_audit.user_audit_log_group_manager,1,1,1,1 diff --git a/user_audit/security/user_audit_groups.xml b/user_audit/security/user_audit_groups.xml new file mode 100755 index 000000000..a07c85385 --- /dev/null +++ b/user_audit/security/user_audit_groups.xml @@ -0,0 +1,20 @@ + + + + + + User Audit + User Audit + + 20 + + + User + + + + Manager + + + + \ No newline at end of file diff --git a/user_audit/static/description/assets/icons/check.png b/user_audit/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/user_audit/static/description/assets/icons/check.png differ diff --git a/user_audit/static/description/assets/icons/chevron.png b/user_audit/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/user_audit/static/description/assets/icons/chevron.png differ diff --git a/user_audit/static/description/assets/icons/cogs.png b/user_audit/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/user_audit/static/description/assets/icons/cogs.png differ diff --git a/user_audit/static/description/assets/icons/consultation.png b/user_audit/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/user_audit/static/description/assets/icons/consultation.png differ diff --git a/user_audit/static/description/assets/icons/ecom-black.png b/user_audit/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/user_audit/static/description/assets/icons/ecom-black.png differ diff --git a/user_audit/static/description/assets/icons/education-black.png b/user_audit/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/user_audit/static/description/assets/icons/education-black.png differ diff --git a/user_audit/static/description/assets/icons/hotel-black.png b/user_audit/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/user_audit/static/description/assets/icons/hotel-black.png differ diff --git a/user_audit/static/description/assets/icons/license.png b/user_audit/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/user_audit/static/description/assets/icons/license.png differ diff --git a/user_audit/static/description/assets/icons/lifebuoy.png b/user_audit/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/user_audit/static/description/assets/icons/lifebuoy.png differ diff --git a/user_audit/static/description/assets/icons/manufacturing-black.png b/user_audit/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/user_audit/static/description/assets/icons/manufacturing-black.png differ diff --git a/user_audit/static/description/assets/icons/pos-black.png b/user_audit/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/user_audit/static/description/assets/icons/pos-black.png differ diff --git a/user_audit/static/description/assets/icons/puzzle.png b/user_audit/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/user_audit/static/description/assets/icons/puzzle.png differ diff --git a/user_audit/static/description/assets/icons/restaurant-black.png b/user_audit/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/user_audit/static/description/assets/icons/restaurant-black.png differ diff --git a/user_audit/static/description/assets/icons/service-black.png b/user_audit/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/user_audit/static/description/assets/icons/service-black.png differ diff --git a/user_audit/static/description/assets/icons/trading-black.png b/user_audit/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/user_audit/static/description/assets/icons/trading-black.png differ diff --git a/user_audit/static/description/assets/icons/training.png b/user_audit/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/user_audit/static/description/assets/icons/training.png differ diff --git a/user_audit/static/description/assets/icons/update.png b/user_audit/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/user_audit/static/description/assets/icons/update.png differ diff --git a/user_audit/static/description/assets/icons/user.png b/user_audit/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/user_audit/static/description/assets/icons/user.png differ diff --git a/user_audit/static/description/assets/icons/wrench.png b/user_audit/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/user_audit/static/description/assets/icons/wrench.png differ diff --git a/user_audit/static/description/assets/misc/categories.png b/user_audit/static/description/assets/misc/categories.png new file mode 100755 index 000000000..bedf1e0b1 Binary files /dev/null and b/user_audit/static/description/assets/misc/categories.png differ diff --git a/user_audit/static/description/assets/misc/check-box.png b/user_audit/static/description/assets/misc/check-box.png new file mode 100755 index 000000000..42caf24b9 Binary files /dev/null and b/user_audit/static/description/assets/misc/check-box.png differ diff --git a/user_audit/static/description/assets/misc/compass.png b/user_audit/static/description/assets/misc/compass.png new file mode 100755 index 000000000..d5fed8faa Binary files /dev/null and b/user_audit/static/description/assets/misc/compass.png differ diff --git a/user_audit/static/description/assets/misc/corporate.png b/user_audit/static/description/assets/misc/corporate.png new file mode 100755 index 000000000..2eb13edbf Binary files /dev/null and b/user_audit/static/description/assets/misc/corporate.png differ diff --git a/user_audit/static/description/assets/misc/customer-support.png b/user_audit/static/description/assets/misc/customer-support.png new file mode 100755 index 000000000..79efc72ed Binary files /dev/null and b/user_audit/static/description/assets/misc/customer-support.png differ diff --git a/user_audit/static/description/assets/misc/cybrosys-logo.png b/user_audit/static/description/assets/misc/cybrosys-logo.png new file mode 100755 index 000000000..cc3cc0ccf Binary files /dev/null and b/user_audit/static/description/assets/misc/cybrosys-logo.png differ diff --git a/user_audit/static/description/assets/misc/features.png b/user_audit/static/description/assets/misc/features.png new file mode 100755 index 000000000..b41769f77 Binary files /dev/null and b/user_audit/static/description/assets/misc/features.png differ diff --git a/user_audit/static/description/assets/misc/logo.png b/user_audit/static/description/assets/misc/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/user_audit/static/description/assets/misc/logo.png differ diff --git a/user_audit/static/description/assets/misc/pictures.png b/user_audit/static/description/assets/misc/pictures.png new file mode 100755 index 000000000..56d255fe9 Binary files /dev/null and b/user_audit/static/description/assets/misc/pictures.png differ diff --git a/user_audit/static/description/assets/misc/pie-chart.png b/user_audit/static/description/assets/misc/pie-chart.png new file mode 100755 index 000000000..426e05244 Binary files /dev/null and b/user_audit/static/description/assets/misc/pie-chart.png differ diff --git a/user_audit/static/description/assets/misc/right-arrow.png b/user_audit/static/description/assets/misc/right-arrow.png new file mode 100755 index 000000000..730984a06 Binary files /dev/null and b/user_audit/static/description/assets/misc/right-arrow.png differ diff --git a/user_audit/static/description/assets/misc/star.png b/user_audit/static/description/assets/misc/star.png new file mode 100755 index 000000000..2eb9ab29f Binary files /dev/null and b/user_audit/static/description/assets/misc/star.png differ diff --git a/user_audit/static/description/assets/misc/support.png b/user_audit/static/description/assets/misc/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/user_audit/static/description/assets/misc/support.png differ diff --git a/user_audit/static/description/assets/misc/whatsapp.png b/user_audit/static/description/assets/misc/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/user_audit/static/description/assets/misc/whatsapp.png differ diff --git a/user_audit/static/description/assets/modules/1.png b/user_audit/static/description/assets/modules/1.png new file mode 100755 index 000000000..489f44e86 Binary files /dev/null and b/user_audit/static/description/assets/modules/1.png differ diff --git a/user_audit/static/description/assets/modules/2.png b/user_audit/static/description/assets/modules/2.png new file mode 100755 index 000000000..4f9e87f6e Binary files /dev/null and b/user_audit/static/description/assets/modules/2.png differ diff --git a/user_audit/static/description/assets/modules/3.png b/user_audit/static/description/assets/modules/3.png new file mode 100755 index 000000000..e571015b1 Binary files /dev/null and b/user_audit/static/description/assets/modules/3.png differ diff --git a/user_audit/static/description/assets/modules/4.png b/user_audit/static/description/assets/modules/4.png new file mode 100755 index 000000000..624ef69b7 Binary files /dev/null and b/user_audit/static/description/assets/modules/4.png differ diff --git a/user_audit/static/description/assets/modules/5.gif b/user_audit/static/description/assets/modules/5.gif new file mode 100755 index 000000000..8f40aab85 Binary files /dev/null and b/user_audit/static/description/assets/modules/5.gif differ diff --git a/user_audit/static/description/assets/modules/6.png b/user_audit/static/description/assets/modules/6.png new file mode 100755 index 000000000..31ed46762 Binary files /dev/null and b/user_audit/static/description/assets/modules/6.png differ diff --git a/user_audit/static/description/assets/screenshots/hero.gif b/user_audit/static/description/assets/screenshots/hero.gif new file mode 100755 index 000000000..8f6b56cee Binary files /dev/null and b/user_audit/static/description/assets/screenshots/hero.gif differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_01.png b/user_audit/static/description/assets/screenshots/user_audit_01.png new file mode 100755 index 000000000..6894d28ca Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_01.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_02.png b/user_audit/static/description/assets/screenshots/user_audit_02.png new file mode 100755 index 000000000..81fd77862 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_02.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_03.png b/user_audit/static/description/assets/screenshots/user_audit_03.png new file mode 100755 index 000000000..3a436ffe0 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_03.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_04.png b/user_audit/static/description/assets/screenshots/user_audit_04.png new file mode 100755 index 000000000..eab954331 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_04.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_05.png b/user_audit/static/description/assets/screenshots/user_audit_05.png new file mode 100755 index 000000000..3a7a9ea0d Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_05.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_06.png b/user_audit/static/description/assets/screenshots/user_audit_06.png new file mode 100755 index 000000000..e440f685c Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_06.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_07.png b/user_audit/static/description/assets/screenshots/user_audit_07.png new file mode 100755 index 000000000..c825b76e9 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_07.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_08.png b/user_audit/static/description/assets/screenshots/user_audit_08.png new file mode 100755 index 000000000..9b4ed6c66 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_08.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_09.png b/user_audit/static/description/assets/screenshots/user_audit_09.png new file mode 100755 index 000000000..0cb5d2550 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_09.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_10.png b/user_audit/static/description/assets/screenshots/user_audit_10.png new file mode 100755 index 000000000..52bc7003f Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_10.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_11.png b/user_audit/static/description/assets/screenshots/user_audit_11.png new file mode 100755 index 000000000..866c0afbf Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_11.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_12.png b/user_audit/static/description/assets/screenshots/user_audit_12.png new file mode 100755 index 000000000..e9f32b8f2 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_12.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_13.png b/user_audit/static/description/assets/screenshots/user_audit_13.png new file mode 100755 index 000000000..21db2f336 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_13.png differ diff --git a/user_audit/static/description/assets/screenshots/user_audit_14.png b/user_audit/static/description/assets/screenshots/user_audit_14.png new file mode 100755 index 000000000..679c759f4 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/user_audit_14.png differ diff --git a/user_audit/static/description/banner.png b/user_audit/static/description/banner.png new file mode 100755 index 000000000..d6662df73 Binary files /dev/null and b/user_audit/static/description/banner.png differ diff --git a/user_audit/static/description/icon.png b/user_audit/static/description/icon.png new file mode 100755 index 000000000..39f9b0a12 Binary files /dev/null and b/user_audit/static/description/icon.png differ diff --git a/user_audit/static/description/index.html b/user_audit/static/description/index.html new file mode 100755 index 000000000..d0371ff5b --- /dev/null +++ b/user_audit/static/description/index.html @@ -0,0 +1,569 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ +
+
+
+ +

User Activity Audit +

+

Track User's All Type of Activities Like Create Write, + Read on Various Models and Records etc

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

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ This module helps you to track all the user's activities like create, write, read etc. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + Track all the user's activities +
+
+ + Easy way to monitor different user's activities +
+
+
+
+ + Available in Odoo 16.0 + Community and Enterprise. +
+
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+
+

User Audit Configuration +

+

User Audit -> Configuration + -> + Click on the new button to set up the tracking such as read, write, create, delete +

+ +
+
+

Tracking The Create +

+

By setting up the creation tracking create a record from the model selected in the user audit and save the record

+ + +
+
+

Audit Create Log +

+

User Audit -> User Audit Logs we can see one record has been created based on the creation activity +

+ +
+
+

Tracking Read Activity +

+

By setting up for tracking read operation in user audit open a record +

+ +
+
+

Audit Read Log +

+

We can see one log has been created based on the read activity +

+ +
+
+

Tracking Write Operation +

+

By setting up for tracking the write operation form the user audit edit and do some write on the specified model +

+ +
+
+

Audit Write Operation +

+

Go to User Audit Logs we can see the one record is created based on the write operation +

+ +
+
+

Tracking Delete Operation +

+

By setting up for tracking the delete operation form the user audit delete a record on the specified model +

+ +
+
+

Audit Delete Operation +

+

Go to audit log we can see the one record is created based on the delete operation +

+ +
+
+

Clear User Logs +

+

Go to-> User Audit -> Click Clear Logs +

+ +
+
+

Clear User Logs +

+

Apply filter and click CLEAR LOGS button, That will clear the selected items. +

+ + +
+
+

User Groups +

+

User & Companies ->Users ->select the user -> + we can set up manager and user as different groups +

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

Related + 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

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

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/user_audit/static/src/js/form_controller.js b/user_audit/static/src/js/form_controller.js new file mode 100755 index 000000000..f43a952f6 --- /dev/null +++ b/user_audit/static/src/js/form_controller.js @@ -0,0 +1,81 @@ +/** @odoo-module **/ + +import { patch } from "@web/core/utils/patch"; +import { FormController } from "@web/views/form/form_controller"; +import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; +import { useService } from "@web/core/utils/hooks"; +patch(FormController.prototype, 'list-controller-patch', { + setup() { + this._super.apply(arguments); + this.orm = useService("orm"); + }, + //For managing save button click + async saveButtonClicked(params = {}) { + this.disableButtons(); + const record = this.model.root; + let saved = false; + if (this.props.saveRecord) { + saved = await this.props.saveRecord(record, params); + } else { + saved = await record.save(); + } + this.enableButtons(); + if (saved && this.props.onSave) { + this.props.onSave(record, params); + } + var resModel = record.resModel; + var resId = record.resId; + this.orm.call( + "user.audit", + "create_audit_log_for_write", + [resModel,resId], + ).then(function(data) { + }) + return saved; + }, + //For managing create operation + async create() { + await this.model.root.askChanges(); // ensures that isDirty is correct + let canProceed = true; + if (this.model.root.isDirty) { + canProceed = await this.model.root.save({ + stayInEdition: true, + useSaveErrorDialog: true, + }); + } + if (canProceed) { + this.disableButtons(); + await this.model.load({ resId: null }); + this.enableButtons(); + } + var resModel = this.model.root.resModel; + this.orm.call( + "user.audit", + "create_audit_log_for_create", + [resModel], + ).then(function(data) { + }) + }, + //for managing delete operation + async deleteRecord() { + var resModel = this.model.root.resModel; + var resId = this.model.root.resId; + const dialogProps = { + body: this.env._t("Are you sure you want to delete this record?"), + confirm: async () => { + await this.model.root.delete(); + this.orm.call( + "user.audit", + "create_audit_log_for_delete", + [resModel,resId], + ).then(function(data) { + }) + if (!this.model.root.resId) { + this.env.config.historyBack(); + } + }, + cancel: () => {}, + }; + this.dialogService.add(ConfirmationDialog, dialogProps); + } + }) diff --git a/user_audit/static/src/js/list_controller.js b/user_audit/static/src/js/list_controller.js new file mode 100755 index 000000000..98829bc64 --- /dev/null +++ b/user_audit/static/src/js/list_controller.js @@ -0,0 +1,107 @@ +/** @odoo-module **/ + +import { patch } from "@web/core/utils/patch"; +import { ListController } from '@web/views/list/list_controller'; +import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; +import { useService } from "@web/core/utils/hooks"; +patch(ListController.prototype, 'list-controller-patch', { + setup() { + this._super.apply(arguments); + this.orm = useService("orm"); + }, + // For tracking delete operation + async createRecord({ group } = {}) { + const list = (group && group.list) || this.model.root; + var resModel = this.model.rootParams.resModel; + if (this.editable) { + if (!(list instanceof DynamicRecordList)) { + throw new Error("List should be a DynamicRecordList"); + } + if (list.editedRecord) { + await list.editedRecord.save(); + } + if (!list.editedRecord) { + await (group || list).createRecord({}, this.editable === "top"); + } + this.render(); + } else { + this.orm.call( + "user.audit", + "create_audit_log_for_create", + [resModel], + ).then(function(data) { + }) + await this.props.createRecord(); + } + }, + //for tracking write operation + async openRecord(record) { + if (this.archInfo.openAction) { + this.actionService.doActionButton({ + name: this.archInfo.openAction.action, + type: this.archInfo.openAction.type, + resModel: record.resModel, + resId: record.resId, + resIds: record.resIds, + context: record.context, + onClose: async () => { + await record.model.root.load(); + record.model.notify(); + }, + }); + } else { + const activeIds = this.model.root.records.map((datapoint) => datapoint.resId); + this.props.selectRecord(record.resId, { activeIds }); + } + var resModel = record.resModel; + var resId = record.resId + this.orm.call( + "user.audit", + "create_audit_log_for_read", + [resModel,resId], + ).then(function(data) { + }) + }, + //For managing delete of multiple records + async onDeleteSelectedRecords() { + const root = this.model.root; + var resId = root.records[0].resId + const body = + root.isDomainSelected || root.selection.length > 1 + ? this.env._t("Are you sure you want to delete these records?") + : this.env._t("Are you sure you want to delete this record?"); + const dialogProps = { + body, + confirm: async () => { + const total = root.count; + const resIds = await this.model.root.deleteRecords(); + var resModel = this.model.root.resModel; + this.orm.call( + "user.audit", + "create_audit_log_for_delete", + [resModel,resId], + ).then(function(data) { + }) + this.model.notify(); + if ( + root.isDomainSelected && + resIds.length === session.active_ids_limit && + resIds.length < total + ) { + this.notificationService.add( + sprintf( + this.env._t( + `Only the first %s records have been deleted (out of %s selected)` + ), + resIds.length, + total + ), + { title: this.env._t("Warning") } + ); + } + }, + cancel: () => {}, + }; + this.dialogService.add(ConfirmationDialog, dialogProps); + } + }) diff --git a/user_audit/views/user_audit_log_views.xml b/user_audit/views/user_audit_log_views.xml new file mode 100755 index 000000000..36196bbe3 --- /dev/null +++ b/user_audit/views/user_audit_log_views.xml @@ -0,0 +1,72 @@ + + + + + user.audit.log.view.form + user.audit.log + +
+ + + + + + + + + + + + + + +
+
+
+ + + user.audit.log.view.tree + user.audit.log + + + + + + + + + + + + + + user.audit.log.view.search + user.audit.log + + + + + + + + + + + + + + + User Audit Logs + user.audit.log + tree,form,kanban + +

+ User Audit Logs +

+
+
+
diff --git a/user_audit/views/user_audit_menus.xml b/user_audit/views/user_audit_menus.xml new file mode 100755 index 000000000..5f884c0b9 --- /dev/null +++ b/user_audit/views/user_audit_menus.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/user_audit/views/user_audit_views.xml b/user_audit/views/user_audit_views.xml new file mode 100755 index 000000000..94c398b2c --- /dev/null +++ b/user_audit/views/user_audit_views.xml @@ -0,0 +1,45 @@ + + + + + user.audit.view.form + user.audit + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ + + User Audit + user.audit + tree,form,kanban + +

+ User Audit +

+
+
+
\ No newline at end of file diff --git a/user_audit/wizard/__init__.py b/user_audit/wizard/__init__.py new file mode 100755 index 000000000..3df818f21 --- /dev/null +++ b/user_audit/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import clear_user_log diff --git a/user_audit/wizard/clear_user_log.py b/user_audit/wizard/clear_user_log.py new file mode 100755 index 000000000..cb89163c4 --- /dev/null +++ b/user_audit/wizard/clear_user_log.py @@ -0,0 +1,168 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class ClearUserLog(models.TransientModel): + """ Model that uses to clear the user audit logs""" + _name = "clear.user.log" + _description = "Clear User Logs" + + full_log = fields.Boolean(string="Full Log", + help="Enabling we can clear full log details") + is_read = fields.Boolean(string="Read", + help="Enabling we can clear all read activities") + is_write = fields.Boolean(string="Write", + help="Enabling we can clear all write activities") + is_create = fields.Boolean(string="Create", + help="Enabling we can clear all create activities") + is_delete = fields.Boolean(string="Delete", + help="Enabling we can clear all delete activities") + to_date = fields.Datetime(string="To Date", + help="Enabling we can clear all activities up to the date") + model_id = fields.Many2one('ir.model', string="Object", + help="Clear selected model's activities") + + def action_clear_user_logs(self): + """ Function that helps to clear the log data based + on the data from the wizard""" + if self.full_log: + self.env['user.audit.log'].search([]).unlink() + elif self.is_create and self.is_write and self.is_read and self.is_delete: + self.env['user.audit.log'].search( + [('operation_type', '=', 'create'), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'read'), + ('operation_type', '=', 'delete')]).unlink() + elif self.is_create and self.is_write and self.is_read: + self.env['user.audit.log'].search( + [('operation_type', '=', 'create'), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'read')]).unlink() + elif self.is_create and self.is_write and self.is_delete: + self.env['user.audit.log'].search( + [('operation_type', '=', 'create'), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'delete')]).unlink() + elif self.is_create and self.is_read and self.is_delete: + self.env['user.audit.log'].search( + [('operation_type', '=', 'create'), + ('operation_type', '=', 'read'), + ('operation_type', '=', 'delete')]).unlink() + elif self.is_delete and self.is_write and self.is_read: + self.env['user.audit.log'].search( + [('operation_type', '=', 'delete'), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'read')]).unlink() + elif self.to_date and self.is_create and self.is_read: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'create'), + ('operation_type', '=', 'read')]).unlink() + elif self.to_date and self.is_create and self.is_write: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'create'), + ('operation_type', '=', 'write')]).unlink() + elif self.to_date and self.is_create and self.is_delete: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'create'), + ('operation_type', '=', 'delete')]).unlink() + elif self.to_date and self.is_write and self.is_delete: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'delete')]).unlink() + elif self.to_date and self.is_read and self.is_delete: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'read'), + ('operation_type', '=', 'delete')]).unlink() + elif self.to_date and self.is_write and self.is_read: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'read')]).unlink() + elif self.to_date and self.is_create and self.is_read: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'create'), + ('operation_type', '=', 'read')]).unlink() + elif self.to_date and self.is_create and self.is_delete: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'delete'), + ('operation_type', '=', 'create')]).unlink() + elif self.to_date and self.is_create and self.is_write: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'create'), + ('operation_type', '=', 'write')]).unlink() + elif self.to_date and self.is_write and self.is_read: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'read')]).unlink() + elif self.to_date and self.is_write and self.is_delete: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'read')]).unlink() + elif self.to_date and self.is_read and self.is_delete: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'write'), + ('operation_type', '=', 'delete')]).unlink() + elif self.to_date and self.is_create: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'create')]).unlink() + elif self.to_date and self.is_delete: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'delete')]).unlink() + elif self.to_date and self.is_read: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'read')]).unlink() + elif self.to_date and self.is_write: + self.env['user.audit.log'].search( + [('date', '<', self.to_date), + ('operation_type', '=', 'write')]).unlink() + elif self.is_create: + self.env['user.audit.log'].search( + [('operation_type', '=', 'create')]).unlink() + elif self.is_read: + self.env['user.audit.log'].search( + [('operation_type', '=', 'read')]).unlink() + elif self.is_write: + self.env['user.audit.log'].search( + [('operation_type', '=', 'write')]).unlink() + elif self.is_delete: + self.env['user.audit.log'].search( + [('operation_type', '=', 'delete')]).unlink() + elif self.to_date: + self.env['user.audit.log'].search( + [('date', '<', self.to_date)]).unlink() + else: + self.env['user.audit.log'].search([]).unlink() diff --git a/user_audit/wizard/clear_user_log_views.xml b/user_audit/wizard/clear_user_log_views.xml new file mode 100755 index 000000000..be492096c --- /dev/null +++ b/user_audit/wizard/clear_user_log_views.xml @@ -0,0 +1,47 @@ + + + + + clear.user.log.view.form + clear.user.log + +
+ + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Clear Audit Logs + clear.user.log + new + form + +

+ Clear Audit Logs +

+
+
+
\ No newline at end of file