diff --git a/user_audit/README.rst b/user_audit/README.rst new file mode 100755 index 000000000..8435db2da --- /dev/null +++ b/user_audit/README.rst @@ -0,0 +1,55 @@ +.. 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, + (V18) Manasa T P + 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..604cad41f --- /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": "18.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', + 'security/user_audit_security.xml', + '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..0923cc876 --- /dev/null +++ b/user_audit/doc/RELEASE_NOTES.md @@ -0,0 +1,5 @@ +## Module +#### 5.11.2024 +#### Version 18.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..715dff1a3 --- /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'].sudo().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'].sudo().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'].sudo().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'].sudo().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 100644 index 000000000..a9957e22f --- /dev/null +++ b/user_audit/security/ir.model.access.csv @@ -0,0 +1,9 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +user_audit.access_user_audit_log_admin,access.user.audit.log.admin,user_audit.model_user_audit_log,user_audit.group_user_audit_admin,1,1,1,1 +user_audit.access_user_audit_log,access.user.audit.log,user_audit.model_user_audit_log,user_audit.group_user_audit_user,1,0,1,0 + +user_audit.access_user_audit_admin,access.user.audit.admin,user_audit.model_user_audit,user_audit.group_user_audit_admin,1,1,1,1 +user_audit.access_user_audit,access.user.audit,user_audit.model_user_audit,user_audit.group_user_audit_user,1,0,1,0 + +user_audit.access_clear_user_log_admin,access.clear.user.log.admin,user_audit.model_clear_user_log,user_audit.group_user_audit_admin,1,1,1,1 +user_audit.access_clear_user_log,access.clear.user.log,user_audit.model_clear_user_log,user_audit.group_user_audit_user,1,0,1,0 \ No newline at end of file diff --git a/user_audit/security/user_audit_groups.xml b/user_audit/security/user_audit_groups.xml new file mode 100644 index 000000000..13e103108 --- /dev/null +++ b/user_audit/security/user_audit_groups.xml @@ -0,0 +1,18 @@ + + + + + User Audit + User Audit + + + User + + + + Manager + + + + + diff --git a/user_audit/security/user_audit_security.xml b/user_audit/security/user_audit_security.xml new file mode 100644 index 000000000..5208599bb --- /dev/null +++ b/user_audit/security/user_audit_security.xml @@ -0,0 +1,17 @@ + + + + + User access + + [('user_id','=',user.id)] + + + + Admin full access + + + [(1, '=', 1)] + + + diff --git a/user_audit/static/description/assets/cybro-icon.png b/user_audit/static/description/assets/cybro-icon.png new file mode 100755 index 000000000..06e73e11d Binary files /dev/null and b/user_audit/static/description/assets/cybro-icon.png differ diff --git a/user_audit/static/description/assets/cybro-odoo.png b/user_audit/static/description/assets/cybro-odoo.png new file mode 100755 index 000000000..ed02e07a4 Binary files /dev/null and b/user_audit/static/description/assets/cybro-odoo.png differ diff --git a/user_audit/static/description/assets/h2.png b/user_audit/static/description/assets/h2.png new file mode 100755 index 000000000..0bfc4707d Binary files /dev/null and b/user_audit/static/description/assets/h2.png differ diff --git a/user_audit/static/description/assets/icons/arrows-repeat.svg b/user_audit/static/description/assets/icons/arrows-repeat.svg new file mode 100755 index 000000000..1d7efabc5 --- /dev/null +++ b/user_audit/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/banner-1.png b/user_audit/static/description/assets/icons/banner-1.png new file mode 100755 index 000000000..c180db172 Binary files /dev/null and b/user_audit/static/description/assets/icons/banner-1.png differ diff --git a/user_audit/static/description/assets/icons/banner-2.svg b/user_audit/static/description/assets/icons/banner-2.svg new file mode 100755 index 000000000..e606d97d9 --- /dev/null +++ b/user_audit/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/banner-bg.png b/user_audit/static/description/assets/icons/banner-bg.png new file mode 100755 index 000000000..a8238d3c0 Binary files /dev/null and b/user_audit/static/description/assets/icons/banner-bg.png differ diff --git a/user_audit/static/description/assets/icons/banner-bg.svg b/user_audit/static/description/assets/icons/banner-bg.svg new file mode 100755 index 000000000..b1378103e --- /dev/null +++ b/user_audit/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/banner-call.svg b/user_audit/static/description/assets/icons/banner-call.svg new file mode 100755 index 000000000..96c687e81 --- /dev/null +++ b/user_audit/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/user_audit/static/description/assets/icons/banner-mail.svg b/user_audit/static/description/assets/icons/banner-mail.svg new file mode 100755 index 000000000..cbf0d158d --- /dev/null +++ b/user_audit/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/user_audit/static/description/assets/icons/banner-pattern.svg b/user_audit/static/description/assets/icons/banner-pattern.svg new file mode 100755 index 000000000..9c1c7e101 --- /dev/null +++ b/user_audit/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/banner-promo.svg b/user_audit/static/description/assets/icons/banner-promo.svg new file mode 100755 index 000000000..d52791b11 --- /dev/null +++ b/user_audit/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/brand-pair.svg b/user_audit/static/description/assets/icons/brand-pair.svg new file mode 100755 index 000000000..d8db7fc1e --- /dev/null +++ b/user_audit/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/close-icon.svg b/user_audit/static/description/assets/icons/close-icon.svg new file mode 100755 index 000000000..df8cce37a --- /dev/null +++ b/user_audit/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + 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/collabarate-icon.svg b/user_audit/static/description/assets/icons/collabarate-icon.svg new file mode 100755 index 000000000..dd4e10518 --- /dev/null +++ b/user_audit/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + 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/cybro-logo.png b/user_audit/static/description/assets/icons/cybro-logo.png new file mode 100755 index 000000000..ff4b78220 Binary files /dev/null and b/user_audit/static/description/assets/icons/cybro-logo.png differ diff --git a/user_audit/static/description/assets/icons/down.svg b/user_audit/static/description/assets/icons/down.svg new file mode 100755 index 000000000..f21c36271 --- /dev/null +++ b/user_audit/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file 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/faq.png b/user_audit/static/description/assets/icons/faq.png new file mode 100755 index 000000000..4250b5b81 Binary files /dev/null and b/user_audit/static/description/assets/icons/faq.png differ diff --git a/user_audit/static/description/assets/icons/feature-icon.svg b/user_audit/static/description/assets/icons/feature-icon.svg new file mode 100755 index 000000000..fa0ea6850 --- /dev/null +++ b/user_audit/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/feature.png b/user_audit/static/description/assets/icons/feature.png new file mode 100755 index 000000000..ac7a785c0 Binary files /dev/null and b/user_audit/static/description/assets/icons/feature.png differ diff --git a/user_audit/static/description/assets/icons/gear.svg b/user_audit/static/description/assets/icons/gear.svg new file mode 100755 index 000000000..0cc66b6ea --- /dev/null +++ b/user_audit/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/hero.gif b/user_audit/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..b07b6557e Binary files /dev/null and b/user_audit/static/description/assets/icons/hero.gif differ diff --git a/user_audit/static/description/assets/icons/hire-odoo.svg b/user_audit/static/description/assets/icons/hire-odoo.svg new file mode 100755 index 000000000..e1ac089b0 --- /dev/null +++ b/user_audit/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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/life-ring-icon.svg b/user_audit/static/description/assets/icons/life-ring-icon.svg new file mode 100755 index 000000000..3ae6e1d89 --- /dev/null +++ b/user_audit/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + 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/mail.svg b/user_audit/static/description/assets/icons/mail.svg new file mode 100755 index 000000000..1eedde695 --- /dev/null +++ b/user_audit/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + 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/notes.png b/user_audit/static/description/assets/icons/notes.png new file mode 100755 index 000000000..ee5e95404 Binary files /dev/null and b/user_audit/static/description/assets/icons/notes.png differ diff --git a/user_audit/static/description/assets/icons/notification icon.svg b/user_audit/static/description/assets/icons/notification icon.svg new file mode 100755 index 000000000..053189973 --- /dev/null +++ b/user_audit/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/odoo-consultancy.svg b/user_audit/static/description/assets/icons/odoo-consultancy.svg new file mode 100755 index 000000000..e05f65bde --- /dev/null +++ b/user_audit/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/user_audit/static/description/assets/icons/odoo-licencing.svg b/user_audit/static/description/assets/icons/odoo-licencing.svg new file mode 100755 index 000000000..2606c88b0 --- /dev/null +++ b/user_audit/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/user_audit/static/description/assets/icons/odoo-logo.png b/user_audit/static/description/assets/icons/odoo-logo.png new file mode 100755 index 000000000..0e4d0eb5a Binary files /dev/null and b/user_audit/static/description/assets/icons/odoo-logo.png differ diff --git a/user_audit/static/description/assets/icons/patter.svg b/user_audit/static/description/assets/icons/patter.svg new file mode 100755 index 000000000..25c9c0a8f --- /dev/null +++ b/user_audit/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/pattern1.png b/user_audit/static/description/assets/icons/pattern1.png new file mode 100755 index 000000000..09ab0fb2d Binary files /dev/null and b/user_audit/static/description/assets/icons/pattern1.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-piece-icon.svg b/user_audit/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100755 index 000000000..3e9ad9373 --- /dev/null +++ b/user_audit/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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/replace-icon.svg b/user_audit/static/description/assets/icons/replace-icon.svg new file mode 100755 index 000000000..d0e3a7af1 --- /dev/null +++ b/user_audit/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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/screenshot-main.png b/user_audit/static/description/assets/icons/screenshot-main.png new file mode 100755 index 000000000..575f8e676 Binary files /dev/null and b/user_audit/static/description/assets/icons/screenshot-main.png differ diff --git a/user_audit/static/description/assets/icons/screenshot.png b/user_audit/static/description/assets/icons/screenshot.png new file mode 100755 index 000000000..cef272529 Binary files /dev/null and b/user_audit/static/description/assets/icons/screenshot.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/skype-fill.svg b/user_audit/static/description/assets/icons/skype-fill.svg new file mode 100755 index 000000000..c17423639 --- /dev/null +++ b/user_audit/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/skype.png b/user_audit/static/description/assets/icons/skype.png new file mode 100755 index 000000000..51b409fb3 Binary files /dev/null and b/user_audit/static/description/assets/icons/skype.png differ diff --git a/user_audit/static/description/assets/icons/skype.svg b/user_audit/static/description/assets/icons/skype.svg new file mode 100755 index 000000000..df3dad39b --- /dev/null +++ b/user_audit/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/user_audit/static/description/assets/icons/star-1.svg b/user_audit/static/description/assets/icons/star-1.svg new file mode 100755 index 000000000..7e55ab162 --- /dev/null +++ b/user_audit/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/star-2.svg b/user_audit/static/description/assets/icons/star-2.svg new file mode 100755 index 000000000..5ae9f507a --- /dev/null +++ b/user_audit/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/user_audit/static/description/assets/icons/support.png b/user_audit/static/description/assets/icons/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/user_audit/static/description/assets/icons/support.png differ diff --git a/user_audit/static/description/assets/icons/test-1 - Copy.png b/user_audit/static/description/assets/icons/test-1 - Copy.png new file mode 100755 index 000000000..f6a902663 Binary files /dev/null and b/user_audit/static/description/assets/icons/test-1 - Copy.png differ diff --git a/user_audit/static/description/assets/icons/test-1.png b/user_audit/static/description/assets/icons/test-1.png new file mode 100755 index 000000000..0908add2b Binary files /dev/null and b/user_audit/static/description/assets/icons/test-1.png differ diff --git a/user_audit/static/description/assets/icons/test-2.png b/user_audit/static/description/assets/icons/test-2.png new file mode 100755 index 000000000..4671fe91e Binary files /dev/null and b/user_audit/static/description/assets/icons/test-2.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/translate.svg b/user_audit/static/description/assets/icons/translate.svg new file mode 100755 index 000000000..af9c8a1aa --- /dev/null +++ b/user_audit/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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/video.png b/user_audit/static/description/assets/icons/video.png new file mode 100755 index 000000000..576705b17 Binary files /dev/null and b/user_audit/static/description/assets/icons/video.png differ diff --git a/user_audit/static/description/assets/icons/whatsapp.png b/user_audit/static/description/assets/icons/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/user_audit/static/description/assets/icons/whatsapp.png differ diff --git a/user_audit/static/description/assets/icons/wrench-icon.svg b/user_audit/static/description/assets/icons/wrench-icon.svg new file mode 100755 index 000000000..174b5a465 --- /dev/null +++ b/user_audit/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + 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/modules/1.jpg b/user_audit/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..3cb15fe01 Binary files /dev/null and b/user_audit/static/description/assets/modules/1.jpg differ diff --git a/user_audit/static/description/assets/modules/2.jpg b/user_audit/static/description/assets/modules/2.jpg new file mode 100644 index 000000000..662cadcc3 Binary files /dev/null and b/user_audit/static/description/assets/modules/2.jpg differ diff --git a/user_audit/static/description/assets/modules/3.jpg b/user_audit/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..717a00443 Binary files /dev/null and b/user_audit/static/description/assets/modules/3.jpg 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..00ebf54ad 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.jpg b/user_audit/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..7c67e2eec Binary files /dev/null and b/user_audit/static/description/assets/modules/5.jpg differ diff --git a/user_audit/static/description/assets/modules/6.gif b/user_audit/static/description/assets/modules/6.gif new file mode 100644 index 000000000..a35ece8df Binary files /dev/null and b/user_audit/static/description/assets/modules/6.gif 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..31c259a3d 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..e622f6de3 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..68dfdbc7f 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..50ca1915e 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..253023e80 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..b7753cec8 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..1c46ec43d 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..b9170f8fa 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..bb7af4b65 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..52f73dfb7 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..2e0b75703 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..174f81305 Binary files /dev/null and b/user_audit/static/description/assets/screenshots/9.png differ diff --git a/user_audit/static/description/assets/y18.jpg b/user_audit/static/description/assets/y18.jpg new file mode 100755 index 000000000..eea1714f2 Binary files /dev/null and b/user_audit/static/description/assets/y18.jpg differ diff --git a/user_audit/static/description/banner.jpg b/user_audit/static/description/banner.jpg new file mode 100644 index 000000000..bd4cb6aa0 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..f5ecd5042 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..40ca3c36c --- /dev/null +++ b/user_audit/static/description/index.html @@ -0,0 +1,1224 @@ + + + + + + User Activity Audit + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

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

+

User Activity Audit +

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

Key + Highlights

+
+
+
+
+ +
+
+ Activity Tracking +
+

+ Track all user actions, including create, update (write), read, and delete operations on records.

+
+
+
+
+
+ +
+
+ Access Control +
+

+ Ensure that only authorized users can view and access audit logs. +

+
+
+
+
+
+ +
+
+ Detailed Logs +
+

+ Store information such as the user performed action, record model, record ID and date and time. +

+
+
+
+
+ +
+
+
+ User Activity Audit +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ SetUp Tracking + +

+
+
+

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

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

+ Create New Record + +

+
+
+

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

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

+ Tracked Create Activity +

+
+
+

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

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

+ Read Record + +

+
+
+

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

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

+ Tracked Read Activity + +

+
+
+

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

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

+ Update Record + + +

+
+
+

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

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

+ Tracked Write Activity + +

+
+
+

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

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

+ Delete Record + +

+
+
+

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

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

+ Tracked Delete Activity + + +

+
+
+

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

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

+ Clear Log + + +

+
+
+

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

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

+ Cleared Log View + +

+
+
+

+ User Audit Logs view after clearing. +

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

+ + Security Group + +

+
+
+

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

+
+
+
+
+
+
+
+ +
+

+ Provide Clear Logs option

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

+ The module tracks the following user actions: + Record creation, + Record updates (write), + Record deletion and + Record views (read). +

+
+
+ +
+ +
+

+ Access to the audit logs can be restricted based on user roles and permissions. Typically, only administrators or designated managers have access to the logs. +

+
+
+ +
+ +
+

+ Yes, you can configure the module and action to track specific models or action that are critical to your business processes. +

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

+ Latest Release 18.0.1.0.0 +

+ + 5th November, 2024 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • + +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ + +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ + +
+
+ + + + + + 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..eee726e22 --- /dev/null +++ b/user_audit/static/src/js/list_controller.js @@ -0,0 +1,99 @@ +/** @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 { DynamicRecordList } from "@web/model/relational_model/dynamic_record_list"; +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..34d362fba --- /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.list + user.audit.log + + + + + + + + + + + + + + user.audit.log.view.search + user.audit.log + + + + + + + + + + + + + + + User Audit Logs + user.audit.log + list,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..f162ba8ab --- /dev/null +++ b/user_audit/views/user_audit_menus.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/user_audit/views/user_audit_views.xml b/user_audit/views/user_audit_views.xml new file mode 100755 index 000000000..2e1448605 --- /dev/null +++ b/user_audit/views/user_audit_views.xml @@ -0,0 +1,44 @@ + + + + + user.audit.view.form + user.audit + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ + + User Audit + user.audit + list,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 +

+
+
+