diff --git a/remove_studio_field/README.rst b/remove_studio_field/README.rst new file mode 100755 index 000000000..71bb268a7 --- /dev/null +++ b/remove_studio_field/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/licence-OPL--1-red.svg + :target: https://www.odoo.com/documentation/16.0/legal/licenses.html#odoo-apps + :alt: License: OPL-1 + +Remove Studio Fields +==================== +This module helps to remove the fields added using the Studio Module. + +Configuration +============= +Add the users to the new security group 'Remove Studio Fields' to give access to +the new menu item. + +License +------- +Odoo Proprietary License v1.0 (OPL-1) +(https://www.odoo.com/documentation/16.0/legal/licenses.html#odoo-apps) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: Abhishek E T @cybrosys, 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/remove_studio_field/__init__.py b/remove_studio_field/__init__.py new file mode 100644 index 000000000..869068932 --- /dev/null +++ b/remove_studio_field/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhishek E T (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 +# (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from . import wizard diff --git a/remove_studio_field/__manifest__.py b/remove_studio_field/__manifest__.py new file mode 100644 index 000000000..7d103cd93 --- /dev/null +++ b/remove_studio_field/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhishek E T (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 +# (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +{ + 'name': 'Remove Studio Fields', + 'version': '16.0.1.0.0', + 'category': 'Extra Tools', + 'summary': 'The module helps to remove fields added from Studio', + 'description': """ + We can add fields in models and add them in the views of the corresponding + model using the Odoo Studio. In some cases, the type of fields that we + will create will be Basic. This module simplify the deletion of those + fields, and Custom fields created using Odoo Studio. + """, + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'images': ['static/description/banner.png'], + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'web', 'web_studio'], + 'data': [ + 'security/remove_studio_field_groups.xml', + 'security/ir.model.access.csv', + 'wizard/remove_studio_field_views.xml' + ], + 'license': 'OPL-1', + 'installable': True, + 'auto_install': False, + 'application': False +} diff --git a/remove_studio_field/doc/RELEASE_NOTES.md b/remove_studio_field/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..79cd5ad61 --- /dev/null +++ b/remove_studio_field/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 17.05.2023 +#### Version 16.0.1.0.0 +#### ADD + +- Initial commit for Remove Studio Fields diff --git a/remove_studio_field/security/ir.model.access.csv b/remove_studio_field/security/ir.model.access.csv new file mode 100644 index 000000000..08cdb69ab --- /dev/null +++ b/remove_studio_field/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_remove_studio_field_admin,access.remove.studio.field.admin,model_remove_studio_field,remove_studio_field.remove_studio_field_group_admin,1,1,1,1 \ No newline at end of file diff --git a/remove_studio_field/security/remove_studio_field_groups.xml b/remove_studio_field/security/remove_studio_field_groups.xml new file mode 100644 index 000000000..4e3739358 --- /dev/null +++ b/remove_studio_field/security/remove_studio_field_groups.xml @@ -0,0 +1,14 @@ + + + + + Remove Studio Fields + Helps to manage access to the wizard for removing fields added through Studio + + + + Administrator + Access to the Remove Studio Fields wizard menu + + + \ No newline at end of file diff --git a/remove_studio_field/static/description/assets/icons/check.png b/remove_studio_field/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/check.png differ diff --git a/remove_studio_field/static/description/assets/icons/chevron.png b/remove_studio_field/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/chevron.png differ diff --git a/remove_studio_field/static/description/assets/icons/cogs.png b/remove_studio_field/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/cogs.png differ diff --git a/remove_studio_field/static/description/assets/icons/consultation.png b/remove_studio_field/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/consultation.png differ diff --git a/remove_studio_field/static/description/assets/icons/ecom-black.png b/remove_studio_field/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/ecom-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/education-black.png b/remove_studio_field/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/education-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/hotel-black.png b/remove_studio_field/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/hotel-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/license.png b/remove_studio_field/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/license.png differ diff --git a/remove_studio_field/static/description/assets/icons/lifebuoy.png b/remove_studio_field/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/lifebuoy.png differ diff --git a/remove_studio_field/static/description/assets/icons/manufacturing-black.png b/remove_studio_field/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/manufacturing-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/pos-black.png b/remove_studio_field/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/pos-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/puzzle.png b/remove_studio_field/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/puzzle.png differ diff --git a/remove_studio_field/static/description/assets/icons/restaurant-black.png b/remove_studio_field/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/restaurant-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/service-black.png b/remove_studio_field/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/service-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/trading-black.png b/remove_studio_field/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/trading-black.png differ diff --git a/remove_studio_field/static/description/assets/icons/training.png b/remove_studio_field/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/training.png differ diff --git a/remove_studio_field/static/description/assets/icons/update.png b/remove_studio_field/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/update.png differ diff --git a/remove_studio_field/static/description/assets/icons/user.png b/remove_studio_field/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/user.png differ diff --git a/remove_studio_field/static/description/assets/icons/wrench.png b/remove_studio_field/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/remove_studio_field/static/description/assets/icons/wrench.png differ diff --git a/remove_studio_field/static/description/assets/misc/categories.png b/remove_studio_field/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/categories.png differ diff --git a/remove_studio_field/static/description/assets/misc/check-box.png b/remove_studio_field/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/check-box.png differ diff --git a/remove_studio_field/static/description/assets/misc/compass.png b/remove_studio_field/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/compass.png differ diff --git a/remove_studio_field/static/description/assets/misc/corporate.png b/remove_studio_field/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/corporate.png differ diff --git a/remove_studio_field/static/description/assets/misc/customer-support.png b/remove_studio_field/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/customer-support.png differ diff --git a/remove_studio_field/static/description/assets/misc/cybrosys-logo.png b/remove_studio_field/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/cybrosys-logo.png differ diff --git a/remove_studio_field/static/description/assets/misc/features.png b/remove_studio_field/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/features.png differ diff --git a/remove_studio_field/static/description/assets/misc/gear.png b/remove_studio_field/static/description/assets/misc/gear.png new file mode 100644 index 000000000..0f120cb8e Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/gear.png differ diff --git a/remove_studio_field/static/description/assets/misc/logo.png b/remove_studio_field/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/logo.png differ diff --git a/remove_studio_field/static/description/assets/misc/pictures.png b/remove_studio_field/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/pictures.png differ diff --git a/remove_studio_field/static/description/assets/misc/pie-chart.png b/remove_studio_field/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/pie-chart.png differ diff --git a/remove_studio_field/static/description/assets/misc/right-arrow.png b/remove_studio_field/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/right-arrow.png differ diff --git a/remove_studio_field/static/description/assets/misc/star.png b/remove_studio_field/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/star.png differ diff --git a/remove_studio_field/static/description/assets/misc/support.png b/remove_studio_field/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/support.png differ diff --git a/remove_studio_field/static/description/assets/misc/whatsapp.png b/remove_studio_field/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/remove_studio_field/static/description/assets/misc/whatsapp.png differ diff --git a/remove_studio_field/static/description/assets/modules/1.png b/remove_studio_field/static/description/assets/modules/1.png new file mode 100644 index 000000000..c0aa245ce Binary files /dev/null and b/remove_studio_field/static/description/assets/modules/1.png differ diff --git a/remove_studio_field/static/description/assets/modules/2.png b/remove_studio_field/static/description/assets/modules/2.png new file mode 100644 index 000000000..ed11bd818 Binary files /dev/null and b/remove_studio_field/static/description/assets/modules/2.png differ diff --git a/remove_studio_field/static/description/assets/modules/3.png b/remove_studio_field/static/description/assets/modules/3.png new file mode 100644 index 000000000..038385e41 Binary files /dev/null and b/remove_studio_field/static/description/assets/modules/3.png differ diff --git a/remove_studio_field/static/description/assets/modules/4.png b/remove_studio_field/static/description/assets/modules/4.png new file mode 100644 index 000000000..618e3e6c4 Binary files /dev/null and b/remove_studio_field/static/description/assets/modules/4.png differ diff --git a/remove_studio_field/static/description/assets/modules/5.png b/remove_studio_field/static/description/assets/modules/5.png new file mode 100644 index 000000000..2a722d66e Binary files /dev/null and b/remove_studio_field/static/description/assets/modules/5.png differ diff --git a/remove_studio_field/static/description/assets/modules/6.png b/remove_studio_field/static/description/assets/modules/6.png new file mode 100644 index 000000000..a44d454aa Binary files /dev/null and b/remove_studio_field/static/description/assets/modules/6.png differ diff --git a/remove_studio_field/static/description/assets/screenshots/hero.gif b/remove_studio_field/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..c44ddd32e Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/hero.gif differ diff --git a/remove_studio_field/static/description/assets/screenshots/remove_studio_field_1.png b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_1.png new file mode 100644 index 000000000..a58179c63 Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_1.png differ diff --git a/remove_studio_field/static/description/assets/screenshots/remove_studio_field_2.png b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_2.png new file mode 100644 index 000000000..96068ceda Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_2.png differ diff --git a/remove_studio_field/static/description/assets/screenshots/remove_studio_field_3.png b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_3.png new file mode 100644 index 000000000..4b9b62c7b Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_3.png differ diff --git a/remove_studio_field/static/description/assets/screenshots/remove_studio_field_4.png b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_4.png new file mode 100644 index 000000000..2838567a6 Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_4.png differ diff --git a/remove_studio_field/static/description/assets/screenshots/remove_studio_field_5.png b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_5.png new file mode 100644 index 000000000..459ebf3a9 Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_5.png differ diff --git a/remove_studio_field/static/description/assets/screenshots/remove_studio_field_6.png b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_6.png new file mode 100644 index 000000000..610584f9c Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_6.png differ diff --git a/remove_studio_field/static/description/assets/screenshots/remove_studio_field_7.png b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_7.png new file mode 100644 index 000000000..9442dc879 Binary files /dev/null and b/remove_studio_field/static/description/assets/screenshots/remove_studio_field_7.png differ diff --git a/remove_studio_field/static/description/banner.png b/remove_studio_field/static/description/banner.png new file mode 100644 index 000000000..6a08ed9b1 Binary files /dev/null and b/remove_studio_field/static/description/banner.png differ diff --git a/remove_studio_field/static/description/icon.png b/remove_studio_field/static/description/icon.png new file mode 100644 index 000000000..bf661cc08 Binary files /dev/null and b/remove_studio_field/static/description/icon.png differ diff --git a/remove_studio_field/static/description/index.html b/remove_studio_field/static/description/index.html new file mode 100644 index 000000000..711dbc2db --- /dev/null +++ b/remove_studio_field/static/description/index.html @@ -0,0 +1,652 @@ +
+ +
+ +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Remove Studio Fields +

+

+ This module helps to remove the fields which are added using the Odoo Studio. + The fields have to be removed from the views before deleting them. If any of the fields selected + for deletion is present in any view, the XML IDs of the views will be displayed. The name can be + used to search the view and remove the field from the corresponding view. +

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

+ Explore This Module +

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ This module crafted by Cybrosys Technologies provides an option to delete the fields which are + added using Odoo Studio. Removing those fields are always a headache since sometimes there will + be multiple fields created in different models on adding new field in one model. For e.g, if we + add a field in the Invoice from Studio, a custom field will be added in the 'account.move' model + and another base fields will be added in the models 'account.payment' and 'account.bank.statement.line' + with the same field name (By default, we are not able to delete the base fields in Odoo). + This module makes the life easier for those who use Odoo Studio for customizations as it helps to + delete all the fields(both custom fields and base fields) added using Studio. +
+
+ + + +
+
+ +
+

Configuration +

+
+
+
+ +
+

+ Add the users to the new security group(Remove Studio Fields: Administrator) to give access to the + new menu item. +

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

Features +

+
+
+
+
+ + + Enterprise Support. +
+
+ + + New Menu: Remove Studio Fields to Access the New Wizard. +
+
+ + + Alerts & Notifications +
+
+ +
+
+ + + Available in Odoo 16.0 Enterprise. +
+
+ + + Select and Remove Fields Using the New Wizard. +
+
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+ +
+

+ New menu +

+

+ Enable debug mode + to see the new menu; Technical -> Database Structure -> Remove Studio Fields + to access the new wizard. +

+ +
+ +
+

+ Select Studio fields for delete +

+

+ In the wizard, you can select the fields which are added using Studio. +

+ +
+ +
+

+ More fields can be selected from the tree view +

+

+ Click on 'Search More...' from the dropdown to open the tree view to select more fields. As we can + have multiple fields with same name as mentioned in the Overview, it is + recommended to select all those fields together(the one which is added through Studio and the other + fields created automatically). +

+ +
+ +
+

+ Delete field: Lose data +

+

+ Once you delete a field, you will lose the data stored with that field. So, ensure that you don't need + the data anymore. Else, backup or store the data before deleting the fields. Click on the button + 'REMOVE FIELDS' to delete the selected fields. +

+ +
+ +
+

+ Check the views +

+

+ If we delete the fields which are added in any view, we cannot access those views. So, we have to + remove the fields from the view before deleting. This module makes this step easier. It checks the + views first and return the list of fields and the views in which the fields are used. Then, we can + either open the corresponding view through Studio, select the field in the view, and click on the + button 'REMOVE FROM VIEW', or we can navigate to Settings/ Technical/ User Interface/ Views, search + for the view and edit the XML code to remove the field from the view. +

+ +
+ +
+

+ Notification +

+

+ If we don't have the fields in any views or if we already removed the fields from the views, then a + notification will be displayed after deleting the fields. +

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

Related + Products +

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

Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + + +
+
+ +
+

Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

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

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/remove_studio_field/wizard/__init__.py b/remove_studio_field/wizard/__init__.py new file mode 100755 index 000000000..44016458f --- /dev/null +++ b/remove_studio_field/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhishek E T (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 +# (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +from . import remove_studio_field diff --git a/remove_studio_field/wizard/remove_studio_field.py b/remove_studio_field/wizard/remove_studio_field.py new file mode 100755 index 000000000..eda794488 --- /dev/null +++ b/remove_studio_field/wizard/remove_studio_field.py @@ -0,0 +1,120 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Abhishek E T (Contact : odoo@cybrosys.com) +# +# This program is under the terms of the Odoo Proprietary License v1.0 +# (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the +# Software or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +############################################################################### +""" +The module helps to remove fields added from Odoo UI or Studio. +""" +import logging + +from odoo import fields, models, _ +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class RemoveStudioField(models.TransientModel): + """ + Wizard to select studio fields(x_studio_) and remove them. + Methods: + action_remove_studio_field(): + Delete the selected studio fields. + """ + _name = 'remove.studio.field' + _description = 'Remove Studio Fields' + + field_ids = fields.Many2many( + 'ir.model.fields', string='Studio Fields', required=True, + domain="[('name', 'like', 'x_studio_')]", + help='You can select the fields which are added through Odoo Studio.') + + def action_remove_studio_field(self): + """ Search for the selected fields(x_studio_) in views. If any of the + field is used in any view an error is thrown with the fields and + corresponding views. If the selected fields are not used in any views, + remove them. + Raises: UserError: If any of the selected fields is/are still present + in any view. + Raises: UserError: if there is any error while unlinking the fields. + Returns: + dict: dictionary to show the success notification. + """ + # Makes the given fields clean on all records - remove pending write of + # this field and pop the pending updates of the fields out from the + # cache before unlinking the fields + for record in self.field_ids: + field = self.pool[record.model]._fields.get(record.name, False) + if field: + self.env.cache.clear_dirty_field(field) + error_popup_message = '' + for field in self.field_ids: + self.env[field.model]._pop_field(field.name) + domain = [('arch_db', 'like', field.name), + ('model', '=', field.model)] + views = self.env['ir.ui.view'].search(domain) + field_views = [] + for view in views: + try: + view._check_xml() + except ValidationError as error: + _logger.info(error) + field_views.append(view.name) + if field_views: + error_popup_message = '\n'.join( + [error_popup_message, _('Field: %s', field.display_name), + _('Views: %s') % ', '.join( + str(view) for view in field_views) + ]) + # If the fields are present in any views, display them, so that those + # can be removed from the mentioned views + if error_popup_message: + # if Studio module is installed, we will perform a module upgrade + studio = self.env['ir.module.module'].sudo().search( + [('name', '=', 'web_studio')], limit=1) + if studio and studio.state == 'installed': + studio.button_immediate_upgrade() + raise UserError('\n'.join([ + _("Cannot delete the fields that are still present in views:"), + error_popup_message + ])) + # Set the state of the selected fields as Custom Field(manual) and then + # unlink those fields + query = f""" + UPDATE ir_model_fields set state = 'manual' + WHERE id in {str(tuple(self.field_ids.ids)).replace(',)', ')')}; + DELETE FROM ir_model_fields + WHERE id in {str(tuple(self.field_ids.ids)).replace(',)', ')')}; + """ + try: + self.env.cr.execute(query) + except Exception as error: + raise UserError(f'An error occurred! {error}') from error + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': _('Success'), + 'message': _('The selected fields are deleted.'), + 'sticky': False, + 'type': 'success', + 'next': {'type': 'ir.actions.act_window_close'}, + } + } diff --git a/remove_studio_field/wizard/remove_studio_field_views.xml b/remove_studio_field/wizard/remove_studio_field_views.xml new file mode 100755 index 000000000..526d2957f --- /dev/null +++ b/remove_studio_field/wizard/remove_studio_field_views.xml @@ -0,0 +1,47 @@ + + + + + remove.studio.field.view.form + remove.studio.field + +
+ + + + + + +
+
+
+
+
+
+ + + Remove Studio Fields + remove.studio.field + ir.actions.act_window + form + new + + + +
\ No newline at end of file