diff --git a/undo_redo/README.rst b/undo_redo/README.rst new file mode 100644 index 000000000..f7421ab76 --- /dev/null +++ b/undo_redo/README.rst @@ -0,0 +1,107 @@ +# Odoo Undo Redo + +[![Odoo](https://img.shields.io/badge/Odoo-%23A24689.svg?style=for-the-badge&logo=Odoo&logoColor=white)](https://www.odoo.com) +[![License](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://opensource.org/licenses/MIT) +[![GitHub Stars](https://img.shields.io/github/stars/cybrosystech/Odoo-Undo-Redo?style=for-the-badge)](https://github.com/cybrosystech/Odoo-Undo-Redo) + +## Overview + +Odoo Undo Redo is an open-source module which enables Undo/Redo globally across Odoo. + + +## Features + +- 🌐 **Track and Revert Changes made to Records Automatically using PostgreSQL Triggers. +- 📏 **Undo and Redo Operations Available Instantly From the Form View. + +## Screenshots + +Here are some glimpses of Odoo Undo Redo in action: + + +### 1. Contacts module + +
+ + + Contacts + + + Contacts Change + + + Contacts Undo + + + Contacts Redo + + + Contacts Revert + + +
+ +### 2. Sales module + +
+ + + Sales + + + Sales Undo + + + Sales Redo + + +
+ + +## Configuration + +* No additional configurations needed. + +## Installation + +Follow these steps to set up and run the app: + +1. **Clone the Repository** + ```bash + git clone https://github.com/cybrosystech/Odoo-Undo-Redo.git + cd Odoo-Undo-Redo + + +## Contributing + +## Contributing + +We welcome contributions! Undo and Redo for one2many records is in progress. +If you're interested, feel free to contribute and enhance this functionality. To get started: + +1. Fork the repository. + +2. Create a new branch: + ``` + git checkout -b feature/your-feature-name + ``` +3. Make changes and commit: + ``` + git commit -m "Add your message here" + ``` +4. Push your changes: + ``` + git push origin feature/your-feature-name + ``` +5. Create a Pull Request on GitHub. + +--- +- Submit a pull request with a clear description of your changes. + +## License + +This project is licensed under the . Feel free to use, modify, and distribute it as needed. + +## Contact + +For questions or support, reach out to the maintainers at info@cybrosys.com or open an issue on GitHub. \ No newline at end of file diff --git a/undo_redo/__init__.py b/undo_redo/__init__.py new file mode 100644 index 000000000..95fab583f --- /dev/null +++ b/undo_redo/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models +from .hooks import post_init_hook, uninstall_hook diff --git a/undo_redo/__manifest__.py b/undo_redo/__manifest__.py new file mode 100644 index 000000000..c79851cac --- /dev/null +++ b/undo_redo/__manifest__.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Undo and Redo Option In Odoo', + 'version': '17.0.1.0.0', + 'category': 'Tools', + 'summary': 'Undo and Redo Option In Odoo Form View', + 'description': """This module adds global undo and + redo support in Odoo, letting users easily revert + or restore changes and deletions across all records + except one2many records.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['web'], + 'data': [ + 'security/ir.model.access.csv', + ], + 'assets': { + 'web.assets_backend': [ + 'undo_redo/static/src/js/undo_redo.js', + 'undo_redo/static/src/xml/formrenderer.xml', + ], + }, + 'post_init_hook': 'post_init_hook', + 'uninstall_hook': 'uninstall_hook', + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/undo_redo/doc/RELEASE_NOTES.md b/undo_redo/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..1df917ac3 --- /dev/null +++ b/undo_redo/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 11.07.2025 +#### Version 17.0.1.0.0 +##### ADD + +- Initial Commit for Undo And Redo diff --git a/undo_redo/hooks.py b/undo_redo/hooks.py new file mode 100644 index 000000000..f4da83a5a --- /dev/null +++ b/undo_redo/hooks.py @@ -0,0 +1,277 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +def post_init_hook(env): + + env.cr.execute(""" + CREATE OR REPLACE FUNCTION log_update_data() + RETURNS TRIGGER AS $$ + DECLARE + changed_fields JSONB = '{}'::JSONB; + old_row JSONB; + new_row JSONB; + column_name TEXT; + BEGIN + old_row = to_jsonb(OLD); + new_row = to_jsonb(NEW); + + FOR column_name IN SELECT jsonb_object_keys(old_row) + LOOP + IF old_row ->> column_name IS DISTINCT FROM new_row ->> column_name THEN + changed_fields = jsonb_set( + changed_fields, + array[column_name], + old_row -> column_name + ); + END IF; + END LOOP; + + IF jsonb_typeof(changed_fields) != 'null' AND changed_fields != '{}'::JSONB THEN + BEGIN + INSERT INTO undo_redo (user_id, + table_name, + record_id, + updated_data,mode + ) + VALUES ( + OLD.write_uid, + TG_TABLE_NAME, + OLD.id, + changed_fields,'undo' + ); + EXCEPTION WHEN OTHERS THEN + RETURN NEW; + END; + END IF; + + RETURN NEW; + END; + $$ LANGUAGE plpgsql; + """) + env.cr.execute(""" + CREATE OR REPLACE FUNCTION log_delete_data() + RETURNS TRIGGER AS $$ + BEGIN + DELETE FROM undo_redo + WHERE record_id = OLD.id + AND table_name = TG_TABLE_NAME; + RETURN OLD; + END; + $$ LANGUAGE plpgsql; + """) + env.cr.execute(""" + DO $$ + DECLARE + rec RECORD; + BEGIN + FOR rec IN + SELECT n.nspname, c.relname + FROM pg_class c + JOIN pg_namespace n ON c.relnamespace = n.oid + WHERE c.relkind = 'r' + AND n.nspname NOT IN ('pg_catalog', 'information_schema') AND c.relname != 'undo_redo' + AND EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_schema = n.nspname + AND table_name = c.relname + AND column_name = 'id' + ) + LOOP + EXECUTE format(' + CREATE TRIGGER capture_delete_dynamic + AFTER UPDATE ON %I.%I + FOR EACH ROW + EXECUTE FUNCTION log_update_data();', rec.nspname, rec.relname); + EXECUTE format(' + CREATE TRIGGER log_delete_trigger + AFTER DELETE ON %I.%I + FOR EACH ROW + EXECUTE FUNCTION log_delete_data();', + rec.nspname, rec.relname); + + END LOOP; + END $$; + """) + env.cr.execute(""" + CREATE OR REPLACE FUNCTION add_update_trigger_to_new_tables() + RETURNS VOID AS $$ + DECLARE + rec RECORD; + BEGIN + FOR rec IN + SELECT n.nspname, c.relname + FROM pg_class c + JOIN pg_namespace n ON c.relnamespace = n.oid + WHERE c.relkind = 'r' + AND n.nspname NOT IN ('pg_catalog', 'information_schema') + AND EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_schema = n.nspname + AND table_name = c.relname + AND column_name = 'id' + ) + LOOP + IF NOT EXISTS ( + SELECT 1 + FROM pg_trigger + WHERE tgrelid = (SELECT oid FROM pg_class WHERE relname = rec.relname AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = rec.nspname)) + AND tgname = 'capture_delete_dynamic' + ) THEN + IF rec.relname != 'undo_redo' THEN + EXECUTE format(' + CREATE TRIGGER capture_delete_dynamic + AFTER UPDATE ON %I.%I + FOR EACH ROW + EXECUTE FUNCTION log_update_data();', rec.nspname, rec.relname); + EXECUTE format(' + CREATE TRIGGER log_delete_trigger + AFTER DELETE ON %I.%I + FOR EACH ROW + EXECUTE FUNCTION log_delete_data();', + rec.nspname, rec.relname); + + END IF; + END IF; + END LOOP; + END; + $$ LANGUAGE plpgsql; + """) + env.cr.execute(""" + CREATE OR REPLACE FUNCTION trigger_on_table_creation() + RETURNS EVENT_TRIGGER AS $$ + BEGIN + PERFORM add_update_trigger_to_new_tables(); + END; + $$ LANGUAGE plpgsql; + """) + env.cr.execute(""" + CREATE EVENT TRIGGER auto_add_delete_triggers + ON ddl_command_end + WHEN TAG IN ('CREATE TABLE') + EXECUTE FUNCTION trigger_on_table_creation(); + """) + env.cr.execute(""" + CREATE OR REPLACE FUNCTION handle_log_reinsert() + RETURNS TRIGGER AS $$ + DECLARE + target_table TEXT; + column_list TEXT; + value_list TEXT; + column_count INT; + new_mode TEXT; + latest_id INT; + BEGIN + IF TG_TABLE_NAME = 'undo_redo' THEN + target_table := OLD.table_name; + + column_list := array_to_string( + array(SELECT jsonb_object_keys(OLD.updated_data)), + ', ' + ); + value_list := array_to_string( + array( + SELECT format('%L', OLD.updated_data->>key) + FROM jsonb_object_keys(OLD.updated_data) AS key + ), + ', ' + ); + + new_mode := CASE OLD.mode + WHEN 'undo' THEN 'redo' + ELSE 'undo' + END; + column_count := array_length(string_to_array(column_list, ','), 1); + IF column_count > 1 THEN + EXECUTE format( + 'UPDATE %I SET (%s) = (%s) WHERE id = %L', + target_table, + column_list, + value_list, + OLD.record_id + ); + ELSIF column_count = 1 THEN + EXECUTE format( + 'UPDATE %I SET %s = %s WHERE id = %L', + target_table, + column_list, + value_list, + OLD.record_id + ); + END IF; + SELECT id INTO latest_id + FROM undo_redo + WHERE table_name = OLD.table_name + AND record_id = OLD.record_id + ORDER BY id DESC + LIMIT 1; + + UPDATE undo_redo + SET mode = new_mode + WHERE id = latest_id; + + RETURN OLD; + END IF; + END; + $$ LANGUAGE plpgsql; + + """) + env.cr.execute(""" + CREATE TRIGGER after_delete_trigger + AFTER DELETE ON undo_redo + FOR EACH ROW + EXECUTE FUNCTION handle_log_reinsert(); + """) + +def uninstall_hook(env): + env.cr.execute(""" + DROP EVENT TRIGGER IF EXISTS auto_add_delete_triggers; + """) + env.cr.execute(""" + DROP TRIGGER IF EXISTS after_delete_trigger ON undo_redo; + """) + env.cr.execute(""" + DO $$ + DECLARE + rec RECORD; + BEGIN + FOR rec IN + SELECT n.nspname, c.relname + FROM pg_class c + JOIN pg_namespace n ON c.relnamespace = n.oid + WHERE c.relkind = 'r' + AND n.nspname NOT IN ('pg_catalog', 'information_schema') + LOOP + EXECUTE format('DROP TRIGGER IF EXISTS capture_delete_dynamic ON %I.%I;', + rec.nspname, rec.relname); + EXECUTE format('DROP TRIGGER IF EXISTS log_delete_trigger ON %I.%I;', + rec.nspname, rec.relname); + END LOOP; + END $$; + """) + env.cr.execute(""" + DROP FUNCTION IF EXISTS log_update_data() CASCADE; + DROP FUNCTION IF EXISTS log_delete_data() CASCADE; + DROP FUNCTION IF EXISTS add_update_trigger_to_new_tables() CASCADE; + DROP FUNCTION IF EXISTS trigger_on_table_creation() CASCADE; + DROP FUNCTION IF EXISTS handle_log_reinsert() CASCADE; + """) \ No newline at end of file diff --git a/undo_redo/models/__init__.py b/undo_redo/models/__init__.py new file mode 100644 index 000000000..1054920a4 --- /dev/null +++ b/undo_redo/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import undo_redo diff --git a/undo_redo/models/undo_redo.py b/undo_redo/models/undo_redo.py new file mode 100644 index 000000000..155a88c57 --- /dev/null +++ b/undo_redo/models/undo_redo.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class UndoRedo(models.TransientModel): + """Transient model to temporarily store undo and redo logs for + record changes across all models.""" + _name = 'undo.redo' + _description = 'Undo Redo' + _transient_max_hours = 1 + _transient_max_count = 0 + + table_name = fields.Char(string="Name") + record_id = fields.Integer(string="Record Id") + updated_data = fields.Json("Updated Data") + mode = fields.Selection([ + ('undo', 'Undo'), + ('redo', 'Redo'), + ], string="Mode") + user_id = fields.Many2one("res.users") + + @api.model + def get_data(self, table_name, record_id, mode="undo"): + """Retrieve a list of undo/redo record IDs matching the given table + name,record ID, and operation mode. Most recent record comes first. + """ + undo_record = self.env['undo.redo'].search( + [('table_name', '=', table_name.replace(".", "_")), ('record_id', '=', record_id), ('mode', '=', mode)], + order='id DESC', + ) + return undo_record.ids diff --git a/undo_redo/security/ir.model.access.csv b/undo_redo/security/ir.model.access.csv new file mode 100644 index 000000000..26036592c --- /dev/null +++ b/undo_redo/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_undo_redo,access_undo.redo,model_undo_redo,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/undo_redo/static/description/assets/icons/capture (1).png b/undo_redo/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/undo_redo/static/description/assets/icons/capture (1).png differ diff --git a/undo_redo/static/description/assets/icons/check.png b/undo_redo/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/undo_redo/static/description/assets/icons/check.png differ diff --git a/undo_redo/static/description/assets/icons/chevron.png b/undo_redo/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/undo_redo/static/description/assets/icons/chevron.png differ diff --git a/undo_redo/static/description/assets/icons/cogs.png b/undo_redo/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/undo_redo/static/description/assets/icons/cogs.png differ diff --git a/undo_redo/static/description/assets/icons/consultation.png b/undo_redo/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/undo_redo/static/description/assets/icons/consultation.png differ diff --git a/undo_redo/static/description/assets/icons/ecom-black.png b/undo_redo/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/undo_redo/static/description/assets/icons/ecom-black.png differ diff --git a/undo_redo/static/description/assets/icons/education-black.png b/undo_redo/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/undo_redo/static/description/assets/icons/education-black.png differ diff --git a/undo_redo/static/description/assets/icons/hotel-black.png b/undo_redo/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/undo_redo/static/description/assets/icons/hotel-black.png differ diff --git a/undo_redo/static/description/assets/icons/img.png b/undo_redo/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/undo_redo/static/description/assets/icons/img.png differ diff --git a/undo_redo/static/description/assets/icons/license.png b/undo_redo/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/undo_redo/static/description/assets/icons/license.png differ diff --git a/undo_redo/static/description/assets/icons/lifebuoy.png b/undo_redo/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/undo_redo/static/description/assets/icons/lifebuoy.png differ diff --git a/undo_redo/static/description/assets/icons/manufacturing-black.png b/undo_redo/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/undo_redo/static/description/assets/icons/manufacturing-black.png differ diff --git a/undo_redo/static/description/assets/icons/photo-capture.png b/undo_redo/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/undo_redo/static/description/assets/icons/photo-capture.png differ diff --git a/undo_redo/static/description/assets/icons/pos-black.png b/undo_redo/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/undo_redo/static/description/assets/icons/pos-black.png differ diff --git a/undo_redo/static/description/assets/icons/puzzle.png b/undo_redo/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/undo_redo/static/description/assets/icons/puzzle.png differ diff --git a/undo_redo/static/description/assets/icons/restaurant-black.png b/undo_redo/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/undo_redo/static/description/assets/icons/restaurant-black.png differ diff --git a/undo_redo/static/description/assets/icons/service-black.png b/undo_redo/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/undo_redo/static/description/assets/icons/service-black.png differ diff --git a/undo_redo/static/description/assets/icons/trading-black.png b/undo_redo/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/undo_redo/static/description/assets/icons/trading-black.png differ diff --git a/undo_redo/static/description/assets/icons/training.png b/undo_redo/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/undo_redo/static/description/assets/icons/training.png differ diff --git a/undo_redo/static/description/assets/icons/update.png b/undo_redo/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/undo_redo/static/description/assets/icons/update.png differ diff --git a/undo_redo/static/description/assets/icons/user.png b/undo_redo/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/undo_redo/static/description/assets/icons/user.png differ diff --git a/undo_redo/static/description/assets/icons/wrench.png b/undo_redo/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/undo_redo/static/description/assets/icons/wrench.png differ diff --git a/undo_redo/static/description/assets/misc/Cybrosys R.png b/undo_redo/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/undo_redo/static/description/assets/misc/Cybrosys R.png differ diff --git a/undo_redo/static/description/assets/misc/categories.png b/undo_redo/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/undo_redo/static/description/assets/misc/categories.png differ diff --git a/undo_redo/static/description/assets/misc/check-box.png b/undo_redo/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/undo_redo/static/description/assets/misc/check-box.png differ diff --git a/undo_redo/static/description/assets/misc/compass.png b/undo_redo/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/undo_redo/static/description/assets/misc/compass.png differ diff --git a/undo_redo/static/description/assets/misc/corporate.png b/undo_redo/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/undo_redo/static/description/assets/misc/corporate.png differ diff --git a/undo_redo/static/description/assets/misc/customer-support.png b/undo_redo/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/undo_redo/static/description/assets/misc/customer-support.png differ diff --git a/undo_redo/static/description/assets/misc/cybrosys-logo.png b/undo_redo/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/undo_redo/static/description/assets/misc/cybrosys-logo.png differ diff --git a/undo_redo/static/description/assets/misc/email.svg b/undo_redo/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/undo_redo/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/undo_redo/static/description/assets/misc/features.png b/undo_redo/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/undo_redo/static/description/assets/misc/features.png differ diff --git a/undo_redo/static/description/assets/misc/logo.png b/undo_redo/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/undo_redo/static/description/assets/misc/logo.png differ diff --git a/undo_redo/static/description/assets/misc/phone.svg b/undo_redo/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/undo_redo/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/undo_redo/static/description/assets/misc/pictures.png b/undo_redo/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/undo_redo/static/description/assets/misc/pictures.png differ diff --git a/undo_redo/static/description/assets/misc/pie-chart.png b/undo_redo/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/undo_redo/static/description/assets/misc/pie-chart.png differ diff --git a/undo_redo/static/description/assets/misc/right-arrow.png b/undo_redo/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/undo_redo/static/description/assets/misc/right-arrow.png differ diff --git a/undo_redo/static/description/assets/misc/star (1) 2.svg b/undo_redo/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/undo_redo/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/undo_redo/static/description/assets/misc/star.png b/undo_redo/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/undo_redo/static/description/assets/misc/star.png differ diff --git a/undo_redo/static/description/assets/misc/support (1) 1.svg b/undo_redo/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/undo_redo/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/undo_redo/static/description/assets/misc/support-email.svg b/undo_redo/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/undo_redo/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/undo_redo/static/description/assets/misc/support.png b/undo_redo/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/undo_redo/static/description/assets/misc/support.png differ diff --git a/undo_redo/static/description/assets/misc/tick-mark.svg b/undo_redo/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/undo_redo/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/undo_redo/static/description/assets/misc/whatsapp 1.svg b/undo_redo/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/undo_redo/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/undo_redo/static/description/assets/misc/whatsapp.png b/undo_redo/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/undo_redo/static/description/assets/misc/whatsapp.png differ diff --git a/undo_redo/static/description/assets/misc/whatsapp.svg b/undo_redo/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/undo_redo/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/undo_redo/static/description/assets/modules/m1.png b/undo_redo/static/description/assets/modules/m1.png new file mode 100644 index 000000000..acb4c76c6 Binary files /dev/null and b/undo_redo/static/description/assets/modules/m1.png differ diff --git a/undo_redo/static/description/assets/modules/m2.png b/undo_redo/static/description/assets/modules/m2.png new file mode 100644 index 000000000..3ef91f771 Binary files /dev/null and b/undo_redo/static/description/assets/modules/m2.png differ diff --git a/undo_redo/static/description/assets/modules/m3.png b/undo_redo/static/description/assets/modules/m3.png new file mode 100644 index 000000000..72febf6ae Binary files /dev/null and b/undo_redo/static/description/assets/modules/m3.png differ diff --git a/undo_redo/static/description/assets/modules/m4.png b/undo_redo/static/description/assets/modules/m4.png new file mode 100644 index 000000000..f7d7f9241 Binary files /dev/null and b/undo_redo/static/description/assets/modules/m4.png differ diff --git a/undo_redo/static/description/assets/modules/m5.png b/undo_redo/static/description/assets/modules/m5.png new file mode 100644 index 000000000..1d3324e88 Binary files /dev/null and b/undo_redo/static/description/assets/modules/m5.png differ diff --git a/undo_redo/static/description/assets/modules/m6.png b/undo_redo/static/description/assets/modules/m6.png new file mode 100644 index 000000000..80938c15a Binary files /dev/null and b/undo_redo/static/description/assets/modules/m6.png differ diff --git a/undo_redo/static/description/assets/screenshots/hero.gif b/undo_redo/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..427df833a Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/hero.gif differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-01.png b/undo_redo/static/description/assets/screenshots/undo_redo-01.png new file mode 100644 index 000000000..908b9ee77 Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-01.png differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-02.png b/undo_redo/static/description/assets/screenshots/undo_redo-02.png new file mode 100644 index 000000000..87f07feb3 Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-02.png differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-03.png b/undo_redo/static/description/assets/screenshots/undo_redo-03.png new file mode 100644 index 000000000..e8426ef9d Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-03.png differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-04.png b/undo_redo/static/description/assets/screenshots/undo_redo-04.png new file mode 100644 index 000000000..21fe285df Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-04.png differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-05.png b/undo_redo/static/description/assets/screenshots/undo_redo-05.png new file mode 100644 index 000000000..892df37bd Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-05.png differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-06.png b/undo_redo/static/description/assets/screenshots/undo_redo-06.png new file mode 100644 index 000000000..218f4a8f5 Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-06.png differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-07.png b/undo_redo/static/description/assets/screenshots/undo_redo-07.png new file mode 100644 index 000000000..5036c6155 Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-07.png differ diff --git a/undo_redo/static/description/assets/screenshots/undo_redo-08.png b/undo_redo/static/description/assets/screenshots/undo_redo-08.png new file mode 100644 index 000000000..865e9645c Binary files /dev/null and b/undo_redo/static/description/assets/screenshots/undo_redo-08.png differ diff --git a/undo_redo/static/description/banner.jpg b/undo_redo/static/description/banner.jpg new file mode 100644 index 000000000..5babc303a Binary files /dev/null and b/undo_redo/static/description/banner.jpg differ diff --git a/undo_redo/static/description/icon.png b/undo_redo/static/description/icon.png new file mode 100644 index 000000000..ee4779115 Binary files /dev/null and b/undo_redo/static/description/icon.png differ diff --git a/undo_redo/static/description/index.html b/undo_redo/static/description/index.html new file mode 100644 index 000000000..ff75b2c0a --- /dev/null +++ b/undo_redo/static/description/index.html @@ -0,0 +1,746 @@ + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Undo and Redo Option In Odoo

+

+ Enables Undo/Redo Option globally across Odoo form view. +

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Track and Revert Changes made to Records + Automatically using PostgreSQL Triggers.

+
+
+
+
+
+
+ +
+
+

+ Undo and Redo Operations Available + Instantly From the Form View.

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

+ Let's open Contacts module and we can see + the Undo Redo button disabled since there + are no changes.

+
+
+
+
+
+
+ +
+
+

+ Next, we can change the Address name.

+
+
+
+
+
+
+ +
+
+

+ After changing the address name, the Undo + Button is enabled.

+
+
+
+
+
+
+ +
+
+

+ Next, we can click on the Redo button.

+
+
+
+
+
+
+ +
+
+

+ The Address has been changed to the new one.

+
+
+
+
+
+
+ +
+
+

+ Similarly in the sales module, we can + change the customer of sale order in + quotation state.

+
+
+
+
+
+
+ +
+
+

+ The Undo-Redo button enables and we can + click on undo button for changing back to + original customer name.

+
+
+
+
+
+
+ +
+
+

+ Next we can click on Redo button to go bck to the name we changed.

+
+
+
+
+
+
+
    +
  • + Language Selector On Systray +
  • +
  • + Easily Switch Language +
  • +
  • + Add Languages On Systray +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on: 9th January 2024 +
+

+ Initial Commit for Easy Language Selector.

+
+
+
+
+
+
+
+

+ 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/undo_redo/static/src/js/undo_redo.js b/undo_redo/static/src/js/undo_redo.js new file mode 100644 index 000000000..a7ba2705b --- /dev/null +++ b/undo_redo/static/src/js/undo_redo.js @@ -0,0 +1,56 @@ +/** @odoo-module **/ + +import { FormController } from '@web/views/form/form_controller'; +import { patch } from "@web/core/utils/patch"; +import { useService } from "@web/core/utils/hooks"; +const { useState, onWillStart } = owl; + +patch(FormController.prototype, { +// Setup function initializes services and state + setup() { + super.setup(); + this.orm = useService('orm') + this.state = useState({ + ...this.state, + undo: [], + redo: [], + }) + onWillStart(async () => { + await this.setData(); + }) + }, +// Fetch undo and redo IDs for the current record + async setData(){ + this.state.undo = await this.getData('undo'); + this.state.redo = await this.getData('redo'); + }, +// Perform undo by deleting the most recent undo record + async undo() { + this.state.count = await this.orm.call("undo.redo", "unlink", [this.state.undo[0]]); + await this.setData(); + await this.env.searchModel._notify(); + }, +// Perform redo by deleting the most recent redo record + async redo() { + this.state.count = await this.orm.call("undo.redo", "unlink", [this.state.redo[0]]); + await this.setData(); + await this.env.searchModel._notify(); + }, + getData(mode){ + return this.orm.call("undo.redo", "get_data",[this.props.resModel, this.props.resId, mode]); + }, +// Override save to refresh undo/redo data after save + async save(params = {}) { + const result = await super.save(params) + await this.setData(); + return result; + }, +// Hook to refresh data if the user tries to leave without saving + beforeUnload() { + const result = super.beforeUnload(); + if (!result) { + this.setData(); + } + return result; + } +}); \ No newline at end of file diff --git a/undo_redo/static/src/xml/formrenderer.xml b/undo_redo/static/src/xml/formrenderer.xml new file mode 100644 index 000000000..7b73caf61 --- /dev/null +++ b/undo_redo/static/src/xml/formrenderer.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file