diff --git a/user_audit/README.rst b/user_audit/README.rst new file mode 100755 index 000000000..d864480aa --- /dev/null +++ b/user_audit/README.rst @@ -0,0 +1,50 @@ +.. image:: https://img.shields.io/badge/license-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, + (v15) Safa Faheem PE +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..d4b63604d --- /dev/null +++ b/user_audit/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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..79fe7c193 --- /dev/null +++ b/user_audit/__manifest__.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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": "15.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', + 'user_audit/static/src/js/basic_controller.js', + ]}, + 'images': ['static/description/banner.jpg'], + '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..e8830d734 --- /dev/null +++ b/user_audit/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 09.01.2024 +#### Version 15.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..30a09f540 --- /dev/null +++ b/user_audit/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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..c4967da9e --- /dev/null +++ b/user_audit/models/user_audit.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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..b314c6e34 --- /dev/null +++ b/user_audit/models/user_audit_log.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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/chatter_view.jpg b/user_audit/static/description/assets/modules/chatter_view.jpg new file mode 100644 index 000000000..8890ee31d Binary files /dev/null and b/user_audit/static/description/assets/modules/chatter_view.jpg differ diff --git a/user_audit/static/description/assets/modules/hid_menu.png b/user_audit/static/description/assets/modules/hid_menu.png new file mode 100644 index 000000000..6bc155887 Binary files /dev/null and b/user_audit/static/description/assets/modules/hid_menu.png differ diff --git a/user_audit/static/description/assets/modules/login_style.png b/user_audit/static/description/assets/modules/login_style.png new file mode 100644 index 000000000..e20126a45 Binary files /dev/null and b/user_audit/static/description/assets/modules/login_style.png differ diff --git a/user_audit/static/description/assets/modules/login_user.png b/user_audit/static/description/assets/modules/login_user.png new file mode 100644 index 000000000..4fbe85ac1 Binary files /dev/null and b/user_audit/static/description/assets/modules/login_user.png differ diff --git a/user_audit/static/description/assets/modules/qr_code.png b/user_audit/static/description/assets/modules/qr_code.png new file mode 100644 index 000000000..6bc155887 Binary files /dev/null and b/user_audit/static/description/assets/modules/qr_code.png differ diff --git a/user_audit/static/description/assets/modules/user_audit_v16.png b/user_audit/static/description/assets/modules/user_audit_v16.png new file mode 100755 index 000000000..d6662df73 Binary files /dev/null and b/user_audit/static/description/assets/modules/user_audit_v16.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 100644 index 000000000..85986f706 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 100644 index 000000000..1c9492a9e 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 100644 index 000000000..91d713333 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 100644 index 000000000..6d0f9121a 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 100644 index 000000000..eafc5f3e1 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 100644 index 000000000..6ba405314 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 100644 index 000000000..26d2e2741 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 100644 index 000000000..816288a24 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 100644 index 000000000..409070bfa 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 100644 index 000000000..df3296a0f 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 100644 index 000000000..de33151ae 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 100644 index 000000000..fe816cfbd 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 100644 index 000000000..c5b835c4c 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 100644 index 000000000..bb9835875 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 100644 index 000000000..b3c2b7a48 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.jpg b/user_audit/static/description/banner.jpg new file mode 100644 index 000000000..d7a6e247a Binary files /dev/null and b/user_audit/static/description/banner.jpg differ diff --git a/user_audit/static/description/icon.png b/user_audit/static/description/icon.png new file mode 100644 index 000000000..50d80c6a3 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 100644 index 000000000..ccc97d77d --- /dev/null +++ b/user_audit/static/description/index.html @@ -0,0 +1,611 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ +
+
+
+ +

+ User Activity Audit

+

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

+ + +
+
+
+
+ +
+ x +
+ +
+

+ 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 +
+
+
+
+ + Available in Odoo 15.0 Community and Enterprise. +
+
+
+
+ + asy way to monitor different user's activities +
+
+
+ + +
+
+ +
+

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

+ +
+
+
+ + +
+
+

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

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

+ Support

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/user_audit/static/src/js/basic_controller.js b/user_audit/static/src/js/basic_controller.js new file mode 100644 index 000000000..87cbbcbe9 --- /dev/null +++ b/user_audit/static/src/js/basic_controller.js @@ -0,0 +1,54 @@ +odoo.define('user_audit.AuditBasicController', function (require) { +"use strict"; + +var core = require('web.core'); +var BasicController = require('web.BasicController'); +var rpc = require('web.rpc'); +var Dialog = require('web.Dialog'); + +var _t = core._t; + +var AuditBasicController = BasicController.include({ +// for managing delete operation + _deleteRecords: function (ids) { + var resId; + if (this.viewType == 'list'){ + resId = this.getSelectedRecords()[0].data.id + } + else { + resId = this.renderer.state.data.id + } + var self = this + function doIt() { + var resModel = self.modelName + rpc.query({ + model: 'user.audit', + method: 'create_audit_log_for_delete', + args: [resModel,resId], + }).then(function(data) { + }) + return self.model + .deleteRecords(ids, self.modelName) + .then(self._onDeletedRecords.bind(self, ids)); + } + if (this.confirmOnDelete) { + const message = ids.length > 1 ? + _t("Are you sure you want to delete these records?") : + _t("Are you sure you want to delete this record?"); + let dialog; + const confirmCallback = () => { + doIt().guardedCatch(() => dialog.destroy()); + }; + dialog = Dialog.confirm(this, message, { confirm_callback: confirmCallback }); + } else { + doIt(); + } + } + +}) +return BasicController +}) + + + + 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..30692b396 --- /dev/null +++ b/user_audit/static/src/js/form_controller.js @@ -0,0 +1,36 @@ +odoo.define('user_audit.AuditFormController', function (require) { +"use strict"; + +var core = require('web.core'); +var FormController = require('web.FormController'); +var rpc = require('web.rpc'); + +var AuditFormController = FormController.include({ +// For manging save record + saveRecord: async function () { + const changedFields = await this._super(...arguments); + var resModel = this.modelName + var resId = this.initialState.res_id + rpc.query({ + model: 'user.audit', + method: 'create_audit_log_for_write', + args: [resModel,resId], + }).then(function(data) { + }) + return changedFields + }, + +// For managing create operation + createRecord: async function (parentID, additionalContext) { + this._super(); + var resModel = this.modelName + rpc.query({ + model: 'user.audit', + method: 'create_audit_log_for_create', + args: [resModel], + }).then(function(data) { + }) + } +}) +return AuditFormController +}) 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..edbca2a74 --- /dev/null +++ b/user_audit/static/src/js/list_controller.js @@ -0,0 +1,48 @@ +odoo.define('user_audit.AuditListController', function (require) { +"use strict"; + +var core = require('web.core'); +var ListController = require('web.ListController'); +var rpc = require('web.rpc'); + + +var AuditListController = ListController.include({ + + custom_events: _.extend({}, ListController.prototype.custom_events, { + open_record: '_onOpenRecord', + }), + + // For tracking create operation + _onCreateRecord: function (ev) { + this._super(); + var resModel = this.modelName; + if (this.editable && !state.groupedBy.length) { + this._addRecord(this.handle); + } else { + rpc.query({ + model: 'user.audit', + method: 'create_audit_log_for_create', + args: [resModel], + }).then(function(data) { + }) + this.trigger_up('switch_view', {view_type: 'form', res_id: undefined}); + } + }, + + // For tracking read operation + _onOpenRecord: function(ev) { + this._super(ev); + var resModel = this.modelName; + var record = this.model.get(ev.data.id, {raw: true}) + var resId = record.res_id + rpc.query({ + model: 'user.audit', + method: 'create_audit_log_for_read', + args: [resModel,resId], + }).then(function(data) { + }) + }, + +}) +return AuditListController; +}) 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..a134552ef --- /dev/null +++ b/user_audit/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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..39cca07f1 --- /dev/null +++ b/user_audit/wizard/clear_user_log.py @@ -0,0 +1,168 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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..4f730b482 --- /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