diff --git a/user_audit/README.rst b/user_audit/README.rst new file mode 100755 index 000000000..b792b143a --- /dev/null +++ b/user_audit/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.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 + +Features +======== +* Retrieve the Users Activities. + +Configuration +============= +Enable security group for the user under user audit section in user. +select either Manager or User + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: (V16) Sreeshanth V S, + (V17) Farhana Jahan PT, + 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..d835d95cc --- /dev/null +++ b/user_audit/__manifest__.py @@ -0,0 +1,56 @@ +# -*- 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": "17.0.1.0.0", + "category": "Extra Tools", + "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", + '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.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..8b5688849 --- /dev/null +++ b/user_audit/data/user_audit_data.xml @@ -0,0 +1,12 @@ + + + + + + Sequence + user.audit.log + TA + 2 + + + diff --git a/user_audit/doc/RELEASE_NOTES.md b/user_audit/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..f8673300d --- /dev/null +++ b/user_audit/doc/RELEASE_NOTES.md @@ -0,0 +1,5 @@ +## Module +#### 30.03.2024 +#### Version 17.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..4395dfa4a --- /dev/null +++ b/user_audit/models/user_audit.py @@ -0,0 +1,112 @@ +# -*- 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..ac662bd65 --- /dev/null +++ b/user_audit/models/user_audit_log.py @@ -0,0 +1,56 @@ +# -*- 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..6a8ce5ced --- /dev/null +++ b/user_audit/security/user_audit_groups.xml @@ -0,0 +1,22 @@ + + + + + + User Audit + User Audit + + 20 + + + Manager + + + + User + + + + + diff --git a/user_audit/static/description/assets/icons/capture (1).png b/user_audit/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/user_audit/static/description/assets/icons/capture (1).png differ diff --git a/user_audit/static/description/assets/icons/check.png b/user_audit/static/description/assets/icons/check.png new file mode 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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/img.png b/user_audit/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/user_audit/static/description/assets/icons/img.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 100644 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 100644 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 100644 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/photo-capture.png b/user_audit/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/user_audit/static/description/assets/icons/photo-capture.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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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/Cybrosys R.png b/user_audit/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/user_audit/static/description/assets/misc/Cybrosys R.png differ diff --git a/user_audit/static/description/assets/misc/email.svg b/user_audit/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/user_audit/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/user_audit/static/description/assets/misc/phone.svg b/user_audit/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/user_audit/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/user_audit/static/description/assets/misc/star (1) 2.svg b/user_audit/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/user_audit/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/user_audit/static/description/assets/misc/support (1) 1.svg b/user_audit/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/user_audit/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/user_audit/static/description/assets/misc/support-email.svg b/user_audit/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/user_audit/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/user_audit/static/description/assets/misc/tick-mark.svg b/user_audit/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/user_audit/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/user_audit/static/description/assets/misc/whatsapp 1.svg b/user_audit/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/user_audit/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/user_audit/static/description/assets/misc/whatsapp.svg b/user_audit/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/user_audit/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/user_audit/static/description/assets/modules/1.png b/user_audit/static/description/assets/modules/1.png new file mode 100644 index 000000000..f3c986fc1 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 100644 index 000000000..99298bf4b 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 100644 index 000000000..eb3f8652f 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 100644 index 000000000..7cc3625c7 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.png b/user_audit/static/description/assets/modules/5.png new file mode 100644 index 000000000..d2f60e3d3 Binary files /dev/null and b/user_audit/static/description/assets/modules/5.png differ diff --git a/user_audit/static/description/assets/modules/6.png b/user_audit/static/description/assets/modules/6.png new file mode 100644 index 000000000..51555e88c Binary files /dev/null and b/user_audit/static/description/assets/modules/6.png differ diff --git a/user_audit/static/description/assets/screenshots/1.png b/user_audit/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..a61df54d6 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/1.png differ diff --git a/user_audit/static/description/assets/screenshots/10.png b/user_audit/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..e3d9b22d1 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/10.png differ diff --git a/user_audit/static/description/assets/screenshots/11.png b/user_audit/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..009023cdb Binary files /dev/null and b/user_audit/static/description/assets/screenshots/11.png differ diff --git a/user_audit/static/description/assets/screenshots/12.png b/user_audit/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..cd30608fa Binary files /dev/null and b/user_audit/static/description/assets/screenshots/12.png differ diff --git a/user_audit/static/description/assets/screenshots/2.png b/user_audit/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..09a06884e Binary files /dev/null and b/user_audit/static/description/assets/screenshots/2.png differ diff --git a/user_audit/static/description/assets/screenshots/3.png b/user_audit/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..0016d8b57 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/3.png differ diff --git a/user_audit/static/description/assets/screenshots/4.png b/user_audit/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..9fe98a762 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/4.png differ diff --git a/user_audit/static/description/assets/screenshots/5.png b/user_audit/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..4c4a09de2 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/5.png differ diff --git a/user_audit/static/description/assets/screenshots/6.png b/user_audit/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..1f7653914 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/6.png differ diff --git a/user_audit/static/description/assets/screenshots/7.png b/user_audit/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..f29051436 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/7.png differ diff --git a/user_audit/static/description/assets/screenshots/8.png b/user_audit/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..6880c4928 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/8.png differ diff --git a/user_audit/static/description/assets/screenshots/9.png b/user_audit/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..db74f31b9 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/9.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..5ce255992 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/hero.gif differ diff --git a/user_audit/static/description/banner.jpg b/user_audit/static/description/banner.jpg new file mode 100644 index 000000000..768bab2b0 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..7c22f0a8a 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..5580e35a7 --- /dev/null +++ b/user_audit/static/description/index.html @@ -0,0 +1,821 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ User Activity Audit

+

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

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Track all the User's Activities

+

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

+
+
+
+
+
+
+ +
+
+

+ Easy way to monitor different user's activities

+

Have a module named 'User Audit' that allows monitoring of different user activities +

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

+ User Audit -> Configuration -> Click on the new button to set up the tracking such as Read, Write, Create, Delete. +

+
+
+
+
+
+
+ +
+
+

+ By setting up for tracking Create Operation, Create a record from the Model selected in the User Audit and Save the record. +

+
+
+
+
+
+
+ +
+
+

+ User Audit -> User Audit Logs, We can see one record has been created based on the Creation Activity +

+
+
+
+
+
+
+ +
+
+

+ By setting up for tracking Read Operation, Opens a record from the Model selected in the User Audit. +

+
+
+
+
+
+
+ +
+
+

+ We can see one log has been created based on the Read Activity +

+
+
+
+
+
+
+ +
+
+

+ By setting up for tracking Write Operation, Edit a record from the Model selected in the User Audit. +

+
+
+
+
+
+
+ +
+
+

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

+
+
+
+
+
+
+ +
+
+

+ By setting up for tracking Delete Operation, Delete a record from the Model selected in the User Audit. +

+
+
+
+
+
+
+ +
+
+

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

+
+
+
+
+
+
+ +
+
+

+ Go to User Audit -> Clear Logs. Apply filter and click Clear Logs button, That will clear the selected items. +

+
+
+
+
+
+
+ +
+
+

+ User Audit Logs view after clearing. +

+
+
+
+
+
+
+ +
+
+

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

+
+
+
+
+
+
+
    +
  • + Track all the user's activities. +
  • +
  • + Easy way to monitor different user's activities. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:30th Mar 2023 +
+

+ Initial Commit for User Activity Audit.

+
+
+
+
+
+
+
+

+ Related Products

+
+
+ +
+
+

+ Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

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 + 99456767686 +
+
+
+
+
+
+
+
+
+ + + + + + 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..55bd08551 --- /dev/null +++ b/user_audit/static/src/js/form_controller.js @@ -0,0 +1,62 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { FormController } from "@web/views/form/form_controller"; +import { _t } from "@web/core/l10n/translation"; +import { useService } from "@web/core/utils/hooks"; +import { + deleteConfirmationMessage, + ConfirmationDialog, +} from "@web/core/confirmation_dialog/confirmation_dialog"; + +patch(FormController.prototype, { + setup() { + super.setup(...arguments); + this.orm = useService("orm"); + }, + //For managing Save button click + async saveButtonClicked(params = {}) { + super.saveButtonClicked(params); + var resModel = this.model.root.resModel; + var resId = this.model.root.resId; + this.orm.call( + "user.audit", + "create_audit_log_for_write", + [resModel, resId], + ).then(function(data) {}) + }, + //For managing Create operation + async create() { + super.create(); + var resModel = this.model.root.resModel; + this.orm.call( + "user.audit", + "create_audit_log_for_create", + [resModel], + ).then(function(data) {}) + }, + //Record Delete Confirmation Popup + get deleteConfirmationDialogProps() { + return { + title: _t("Bye-bye, record!"), + body: deleteConfirmationMessage, + confirm: async () => { + await this.model.root.delete(); + this.orm.call( + "user.audit", + "create_audit_log_for_delete", + [this.model.root.resModel, this.model.root.resId], + ).then(function(data) {}) + if (!this.model.root.resId) { + this.env.config.historyBack(); + } + }, + confirmLabel: _t("Delete"), + cancel: () => {}, + cancelLabel: _t("No, keep it"), + }; + }, + //For managing Delete operation + async deleteRecord() { + this.dialogService.add(ConfirmationDialog, this.deleteConfirmationDialogProps); + } +}) 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..b2ba7a3ee --- /dev/null +++ b/user_audit/static/src/js/list_controller.js @@ -0,0 +1,98 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { ListController } from '@web/views/list/list_controller'; +import { useService } from "@web/core/utils/hooks"; +import { _t } from "@web/core/l10n/translation"; +import { + deleteConfirmationMessage, + ConfirmationDialog, +} from "@web/core/confirmation_dialog/confirmation_dialog"; + +patch(ListController.prototype, { + setup() { + super.setup(...arguments); + this.orm = useService("orm"); + }, + // For tracking Create operation + async createRecord({group} = {}) { + const list = (group && group.list) || this.model.root; + var resModel = this.model.root.resModel; + if (this.editable && !list.isGrouped) { + if (!(list instanceof DynamicRecordList)) { + throw new Error("List should be a DynamicRecordList"); + } + await list.leaveEditMode(); + if (!list.editedRecord) { + await (group || list).addNewRecord(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 Read 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) {}) + }, + //Multiple Record Delete Confirmation Popup + get deleteConfirmationDialogProps() { + const root = this.model.root; + let body = deleteConfirmationMessage; + if (root.isDomainSelected || root.selection.length > 1) { + body = _t("Are you sure you want to delete these records?"); + } + return { + title: _t("Bye-bye, record!"), + body, + confirmLabel: _t("Delete"), + confirm: async () => { + await this.model.root.deleteRecords(); + const root = this.model.root; + var resId = root.records[0].resId + var resModel = this.model.root.resModel; + this.orm.call( + "user.audit", + "create_audit_log_for_delete", + [resModel, resId], + ).then(function(data) { + }) + }, + cancel: () => {}, + cancelLabel: _t("No, keep it"), + }; + }, + //For managing Delete of multiple records + async onDeleteSelectedRecords() { + this.dialogService.add(ConfirmationDialog, this.deleteConfirmationDialogProps); + } +}) 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..456a3737e --- /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..c3450b555 --- /dev/null +++ b/user_audit/views/user_audit_menus.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + diff --git a/user_audit/views/user_audit_views.xml b/user_audit/views/user_audit_views.xml new file mode 100755 index 000000000..2ce686b31 --- /dev/null +++ b/user_audit/views/user_audit_views.xml @@ -0,0 +1,44 @@ + + + + + user.audit.view.form + user.audit + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ + + User Audit + user.audit + tree,form,kanban + +

+ User Audit +

+
+
+
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..8e8b13612 --- /dev/null +++ b/user_audit/wizard/clear_user_log.py @@ -0,0 +1,171 @@ +# -*- 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..9f0148966 --- /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 +

+
+
+