@ -0,0 +1,45 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Double Click Field Label Edit |
||||
|
============================= |
||||
|
This module helps you to change label of a field in user interface. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (AGPL v3). |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: (V18) Anzil K A, 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 <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Anzil K A (odoo@cybrosys.com) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from . import models |
@ -0,0 +1,49 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Anzil K A (odoo@cybrosys.com) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
{ |
||||
|
'name': 'Double Click Field Label Edit', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Extra Tools', |
||||
|
'summary': """Double Click A Field To Edit The Label""", |
||||
|
'description': """Edit any fields label by double clicking field and |
||||
|
change the label with any name""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/res_users_views.xml', |
||||
|
'views/label_history_views.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_backend': [ |
||||
|
'edit_label/static/src/js/edit_label.js', |
||||
|
'edit_label/static/src/xml/edit_label_templates.xml' |
||||
|
], |
||||
|
}, |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <edit_label> |
||||
|
|
||||
|
#### 15.11.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for Double Click Field Label Edit |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Anzil K A (odoo@cybrosys.com) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from . import ir_ui_view |
||||
|
from . import label_history |
||||
|
from . import res_users |
@ -0,0 +1,121 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Anzil K A (odoo@cybrosys.com) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo import api, fields, models |
||||
|
from xml.etree import ElementTree |
||||
|
|
||||
|
|
||||
|
class FieldModels(models.Model): |
||||
|
"""Extends `ir.ui.view` to facilitate label modification in XML fields.""" |
||||
|
_inherit = 'ir.ui.view' |
||||
|
|
||||
|
@api.model |
||||
|
def edit_xml_field_label(self, name, view, field, input_field_name, value, |
||||
|
field_name): |
||||
|
"""Edit the XML field label. |
||||
|
Args: |
||||
|
- name: Model name. |
||||
|
- view: Type of view (e.g., 'form', 'tree'). |
||||
|
- field: Field name to modify. |
||||
|
- input_field_name: Input field name. |
||||
|
- value: New label value. |
||||
|
- field_name: Field name in the view. |
||||
|
Returns: |
||||
|
- True if label is edited successfully, False otherwise.""" |
||||
|
# To remove '\' from the label otherwise there is an error in the view |
||||
|
if value[-1] == "\\": |
||||
|
value = value[:-1] |
||||
|
views = self.env['ir.ui.view'].search([('model', '=', name), |
||||
|
('type', '=', view)]) |
||||
|
model_name = self.env['ir.model'].search([('model', '=', name)]).name |
||||
|
use_lang = self.env.context.get('lang') or 'en_US' |
||||
|
flag = False |
||||
|
for view_id in views: |
||||
|
root = ElementTree.fromstring(view_id.arch) |
||||
|
for rank in root.iter('label'): |
||||
|
if rank.get('string') == field_name: |
||||
|
if rank.get('nolabel'): |
||||
|
preceding_div_labels = root.findall(".//label[@for='" + field_name + "']") |
||||
|
for label_tag in preceding_div_labels: |
||||
|
label_tag.set('string', value) |
||||
|
rank.set('string', value) |
||||
|
vals = ElementTree.tostring(root, encoding='unicode') |
||||
|
final_view = self.env['ir.ui.view'].sudo().search( |
||||
|
[('model', '=', name), |
||||
|
('type', '=', view), |
||||
|
('xml_id', '=', view_id.xml_id), |
||||
|
]) |
||||
|
for num in final_view.filtered( |
||||
|
lambda l: l.xml_id == view_id.xml_id): |
||||
|
num.arch = vals |
||||
|
if flag is False: |
||||
|
vals = { |
||||
|
'user_id': self.env.user.id, |
||||
|
'date': fields.Datetime.now(), |
||||
|
'model': model_name, |
||||
|
'old_label': field, |
||||
|
'new_label': value, |
||||
|
} |
||||
|
self.env['label.history'].sudo().create(vals) |
||||
|
flag = True |
||||
|
for rank in root.iter('field'): |
||||
|
if rank.get('name') == field_name: |
||||
|
if rank.get('nolabel'): |
||||
|
preceding_div_labels = root.findall(".//label[@for='" + field_name + "']") |
||||
|
for label_tag in preceding_div_labels: |
||||
|
label_tag.set('string', value) |
||||
|
if rank.get('string'): |
||||
|
rank.set('string', value) |
||||
|
vals = ElementTree.tostring(root, encoding='unicode') |
||||
|
final_view = self.env['ir.ui.view'].sudo().search( |
||||
|
[('model', '=', name), |
||||
|
('type', '=', view), |
||||
|
('xml_id', '=', view_id.xml_id)]) |
||||
|
for num in final_view.filtered( |
||||
|
lambda l: l.xml_id == view_id.xml_id): |
||||
|
num.arch = vals |
||||
|
if flag is False: |
||||
|
vals = { |
||||
|
'user_id': self.env.user.id, |
||||
|
'date': fields.Datetime.now(), |
||||
|
'model': model_name, |
||||
|
'old_label': field, |
||||
|
'new_label': value, |
||||
|
} |
||||
|
self.env['label.history'].sudo().create(vals) |
||||
|
flag = True |
||||
|
# To change the field string value from 'ir.model.fields' |
||||
|
try: |
||||
|
field_obj = self.env['ir.model.fields'].search([ |
||||
|
('model', '=', name), ('name', '=', field_name)]) |
||||
|
field_obj.field_description = value |
||||
|
if not flag: |
||||
|
vals = { |
||||
|
'user_id': self.env.user.id, |
||||
|
'date': fields.Datetime.now(), |
||||
|
'model': model_name, |
||||
|
'old_label': field, |
||||
|
'new_label': value, |
||||
|
} |
||||
|
self.env['label.history'].sudo().create(vals) |
||||
|
return True |
||||
|
except Exception as e: |
||||
|
return False |
@ -0,0 +1,40 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Anzil K A (odoo@cybrosys.com) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class LabelHistory(models.Model): |
||||
|
"""Model for keeping track of label change history.""" |
||||
|
_name = 'label.history' |
||||
|
_description = "History of label changes" |
||||
|
|
||||
|
user_id = fields.Many2one('res.users', string='Changed by', |
||||
|
help='User who made the label change') |
||||
|
date = fields.Datetime(string='Changed On', |
||||
|
help='Date and time of label change') |
||||
|
model = fields.Char(string='Model Name', |
||||
|
help='Name of the model associated with the ' |
||||
|
'label change') |
||||
|
old_label = fields.Char(string='Label Before Change', |
||||
|
help='Previous label value') |
||||
|
new_label = fields.Char(string='Label After Change', |
||||
|
help='New label value after the change') |
@ -0,0 +1,40 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Mruthul Raj (odoo@cybrosys.com) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
################################################################################ |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class ResUser(models.Model): |
||||
|
"""Extends the 'res.users' model to include an 'is_edit_field_label' |
||||
|
field.""" |
||||
|
_inherit = 'res.users' |
||||
|
|
||||
|
is_edit_field_label = fields.Boolean(string='Edit Field Label', |
||||
|
help="Allows the user to edit field " |
||||
|
"labels.") |
||||
|
|
||||
|
@api.model |
||||
|
def login_user(self): |
||||
|
"""Retrieves the 'is_edit_field_label' value for the current user |
||||
|
upon login. |
||||
|
Returns:True if the user can edit field labels, False otherwise.""" |
||||
|
user = self.env.user |
||||
|
return user.is_edit_field_label |
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 258 KiB |
After Width: | Height: | Size: 690 KiB |