@ -1,23 +1,22 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
################################################################################### |
################################################################################ |
||||
# |
# |
||||
# Cybrosys Technologies Pvt. Ltd. |
# Cybrosys Technologies Pvt. Ltd. |
||||
# |
# |
||||
# Copyright (C) 2022-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
# Author: Cybrosys Techno Solutions (<https://www.cybrosys.com>) |
# Author: Cybrosys Techno Solutions (<https://www.cybrosys.com>) |
||||
# |
# |
||||
# This program is free software: you can modify |
# You can modify it under the terms of the GNU AFFERO |
||||
# it under the terms of the GNU Affero General Public License (AGPL) as |
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
# published by the Free Software Foundation, either version 3 of the |
|
||||
# License, or (at your option) any later version. |
|
||||
# |
# |
||||
# This program is distributed in the hope that it will be useful, |
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU Affero General Public License for more details. |
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
# |
# |
||||
# You should have received a copy of the GNU Affero General Public License |
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
# |
# |
||||
################################################################################### |
################################################################################ |
||||
from . import models |
from . import models |
||||
|
@ -1,25 +1,24 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
################################################################################### |
################################################################################ |
||||
# |
# |
||||
# Cybrosys Technologies Pvt. Ltd. |
# Cybrosys Technologies Pvt. Ltd. |
||||
# |
# |
||||
# Copyright (C) 2022-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
# Author: Cybrosys Techno Solutions (<https://www.cybrosys.com>) |
# Author: Cybrosys Techno Solutions (<https://www.cybrosys.com>) |
||||
# |
# |
||||
# This program is free software: you can modify |
# You can modify it under the terms of the GNU AFFERO |
||||
# it under the terms of the GNU Affero General Public License (AGPL) as |
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
# published by the Free Software Foundation, either version 3 of the |
|
||||
# License, or (at your option) any later version. |
|
||||
# |
# |
||||
# This program is distributed in the hope that it will be useful, |
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU Affero General Public License for more details. |
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
# |
# |
||||
# You should have received a copy of the GNU Affero General Public License |
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
# |
# |
||||
################################################################################### |
################################################################################ |
||||
from . import ir_model_fields |
from . import ir_model_fields |
||||
from . import field_widgets |
from . import dynamic_field_widgets |
||||
from . import dynamic_fields |
from . import dynamic_fields |
||||
|
@ -0,0 +1,37 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (<https://www.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 models, fields |
||||
|
|
||||
|
|
||||
|
class DynamicFieldWidgets(models.Model): |
||||
|
"""We can't filter a selection field dynamically so when we select a |
||||
|
field its widgets also need to change according to the selected field |
||||
|
type, we can't do it by a 'selection' field, need a 'Many2one' field. |
||||
|
""" |
||||
|
|
||||
|
_name = 'dynamic.field.widgets' |
||||
|
_rec_name = 'description' |
||||
|
_description = 'Field Widgets' |
||||
|
|
||||
|
name = fields.Char(string="Name", help="Name given to the record") |
||||
|
description = fields.Char(string="Description", |
||||
|
help="Description of the record") |
@ -1,37 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
################################################################################### |
|
||||
# |
|
||||
# Cybrosys Technologies Pvt. Ltd. |
|
||||
# |
|
||||
# Copyright (C) 2022-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
|
||||
# Author: Cybrosys Techno Solutions (<https://www.cybrosys.com>) |
|
||||
# |
|
||||
# This program is free software: you can modify |
|
||||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|
||||
# published by the Free Software Foundation, either version 3 of the |
|
||||
# License, or (at your option) any later version. |
|
||||
# |
|
||||
# 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 for more details. |
|
||||
# |
|
||||
# You should have received a copy of the GNU Affero General Public License |
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from odoo import models, fields |
|
||||
|
|
||||
|
|
||||
class FieldWidgets(models.Model): |
|
||||
"""We can't filter a selection field dynamically |
|
||||
so when we select a field its widgets also need to change according to the selected |
|
||||
field type, we can't do it by a 'selection' field, need a 'Many2one' field. |
|
||||
""" |
|
||||
|
|
||||
_name = 'dynamic.field.widgets' |
|
||||
_rec_name = 'description' |
|
||||
_description = 'Field Widgets' |
|
||||
|
|
||||
name = fields.Char(string="Name") |
|
||||
description = fields.Char(string="Description") |
|
|
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 292 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 325 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 98 KiB |
@ -1,108 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<record id="custom_dynamic_fields_view_tree" model="ir.ui.view"> |
|
||||
<field name="name">custom_dynamic_fields_view_tree</field> |
|
||||
<field name="model">dynamic.fields</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<tree> |
|
||||
<field name="name"/> |
|
||||
<field name="field_description"/> |
|
||||
<field name="model_id"/> |
|
||||
<field name="status"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id='custom_dynamic_fields_view_form' model='ir.ui.view'> |
|
||||
<field name="name">custom_dynamic_fields_view_form</field> |
|
||||
<field name="model">dynamic.fields</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form> |
|
||||
<header> |
|
||||
<button name="create_dynamic_fields" string="Create Field" type="object" class="oe_highlight" |
|
||||
attrs="{'invisible': [('status', 'in', ['form','tree'])]}" groups="all_in_one_dynamic_custom_fields.group_all_in_one_dynamic_custom_fields_administrator"/> |
|
||||
<button name="add_field_to_tree_view" string="Add to Tree View" type="object" class="oe_highlight" |
|
||||
attrs="{'invisible': [('status', 'in', ['draft','tree'])]}" groups="all_in_one_dynamic_custom_fields.group_all_in_one_dynamic_custom_fields_administrator"/> |
|
||||
<field name="status" widget="statusbar" |
|
||||
statusbar_visible="draft,form,tree"/> |
|
||||
</header> |
|
||||
<sheet> |
|
||||
<group> |
|
||||
<group string="Field Info"> |
|
||||
<field name="name"/> |
|
||||
<field name="field_description"/> |
|
||||
<field name="state" readonly="1" groups="base.group_no_one"/> |
|
||||
<field name="model_id" options='{"no_open": True, "no_create": True}'/> |
|
||||
<field name="field_type"/> |
|
||||
<field name="selection_field" placeholder="[('blue', 'Blue'),('yellow', 'Yellow')]" |
|
||||
attrs="{'required': [('field_type','in',['selection','reference'])], |
|
||||
'readonly': [('field_type','not in',['selection','reference'])], |
|
||||
'invisible': [('field_type','not in',['selection','reference'])]}"/> |
|
||||
<field name="ref_model_id" options='{"no_open": True, "no_create": True}' attrs="{'required': [('field_type','in',['many2one','many2many'])], |
|
||||
'readonly': [('field_type','not in',['many2one','many2many'])], |
|
||||
'invisible': [('field_type','not in',['many2one','many2many'])]}"/> |
|
||||
<field name="widget" widget="selection" |
|
||||
attrs="{'invisible': [('field_type','not in',['binary', 'many2many', 'selection', 'float', 'many2one'])]}"/> |
|
||||
<field name="required"/> |
|
||||
<field name="form_view_id"/> |
|
||||
<field name="form_view_inherit_id"/> |
|
||||
</group> |
|
||||
<group string="Tree View"> |
|
||||
<field name="add_field_in_tree"/> |
|
||||
<field name="tree_view_id" attrs="{'invisible': [('add_field_in_tree', '=', False)], |
|
||||
'required': [('add_field_in_tree', '=', True)]}"/> |
|
||||
<field name="tree_view_inherit_id" attrs="{'invisible': [('add_field_in_tree', '=', False)]}"/> |
|
||||
</group> |
|
||||
<group string="Position"> |
|
||||
<field name="position_field" options='{"no_open": True, "no_create": True}'/> |
|
||||
<field name="position"/> |
|
||||
</group> |
|
||||
</group> |
|
||||
<group string="Extra Properties"> |
|
||||
<group> |
|
||||
<field name="extra_features"/> |
|
||||
</group> |
|
||||
<group attrs="{'invisible': [('extra_features', '=', False)]}"> |
|
||||
<field name="help"/> |
|
||||
</group> |
|
||||
<group attrs="{'invisible': [('extra_features', '=', False)]}"> |
|
||||
<field name="readonly"/> |
|
||||
<field name="store"/> |
|
||||
<field name="index"/> |
|
||||
<field name="copied"/> |
|
||||
</group> |
|
||||
</group> |
|
||||
</sheet> |
|
||||
</form> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id='action_dynamic_custom_fields' model='ir.actions.act_window'> |
|
||||
<field name="name">Custom Dynamic Fields</field> |
|
||||
<field name="res_model">dynamic.fields</field> |
|
||||
<field name="view_mode">tree,form</field> |
|
||||
<field name="help" type="html"> |
|
||||
<p class="o_view_nocontent_smiling_face"> |
|
||||
Create New Custom Dynamic Field! |
|
||||
</p> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<menuitem id="menu_all_in_one_dynamic_custom_fields_root" |
|
||||
name="All in One Custom Dynamic Fields" |
|
||||
groups="group_all_in_one_dynamic_custom_fields_user,group_all_in_one_dynamic_custom_fields_administrator" |
|
||||
web_icon="all_in_one_dynamic_custom_fields,static/description/icon.png" |
|
||||
sequence="01"/> |
|
||||
|
|
||||
<menuitem id="menu_create_custom_dynamic_fields" |
|
||||
name="Fields" |
|
||||
parent="menu_all_in_one_dynamic_custom_fields_root" |
|
||||
sequence="1"/> |
|
||||
|
|
||||
<menuitem id="menu_create_fields" |
|
||||
name="Create Fields" |
|
||||
parent="menu_create_custom_dynamic_fields" |
|
||||
action="action_dynamic_custom_fields" |
|
||||
groups="group_all_in_one_dynamic_custom_fields_user,group_all_in_one_dynamic_custom_fields_administrator" |
|
||||
sequence="2"/> |
|
||||
</odoo> |
|
@ -0,0 +1,117 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Dynamic fields view tree --> |
||||
|
<record id="dynamic_fields_view_tree" model="ir.ui.view"> |
||||
|
<field name="name">dynamic.fields.view.tree</field> |
||||
|
<field name="model">dynamic.fields</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<tree> |
||||
|
<field name="name"/> |
||||
|
<field name="field_description"/> |
||||
|
<field name="model_id"/> |
||||
|
<field name="status"/> |
||||
|
</tree> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Dynamic fields view form --> |
||||
|
<record id='dynamic_fields_view_form' model='ir.ui.view'> |
||||
|
<field name="name">dynamic.fields.view.form</field> |
||||
|
<field name="model">dynamic.fields</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<header> |
||||
|
<button name="action_create_dynamic_fields" string="Create Field" type="object" class="oe_highlight" |
||||
|
attrs="{'invisible': [('status', 'in', ['form','tree'])]}" groups="all_in_one_dynamic_custom_fields.group_all_in_one_dynamic_custom_fields_administrator"/> |
||||
|
<button name="action_add_field_to_tree_view" string="Add to Tree View" type="object" class="oe_highlight" |
||||
|
attrs="{'invisible': [('status', 'in', ['draft','tree'])]}" groups="all_in_one_dynamic_custom_fields.group_all_in_one_dynamic_custom_fields_administrator"/> |
||||
|
<field name="status" widget="statusbar" |
||||
|
statusbar_visible="draft,form,tree"/> |
||||
|
</header> |
||||
|
<sheet> |
||||
|
<group> |
||||
|
<group string="Field Info"> |
||||
|
<field name="name" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="field_description" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="state" readonly="1" groups="base.group_no_one"/> |
||||
|
<field name="model_id" options='{"no_open": True, "no_create": True}' attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="field_type" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="selection_field" placeholder="[('blue', 'Blue'),('yellow', 'Yellow')]" |
||||
|
attrs="{'required': [('field_type','in',['selection','reference'])], |
||||
|
'readonly': ['|',('field_type','not in',['selection','reference']), ('status', '!=', 'draft')], |
||||
|
'invisible': [('field_type','not in',['selection','reference'])]}"/> |
||||
|
<field name="ref_model_id" options='{"no_open": True, "no_create": True}' attrs="{'required': [('field_type','in',['many2one','many2many'])], |
||||
|
'readonly': ['|', ('field_type','not in',['many2one','many2many']),('status', '!=', 'draft')], |
||||
|
'invisible': [('field_type','not in',['many2one','many2many'])]}"/> |
||||
|
<field name="widget_id" widget="selection" |
||||
|
attrs="{'invisible': [('field_type','not in',['binary', 'many2many', 'selection', 'float', 'many2one'])], |
||||
|
'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="required" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="form_view_id" attrs="{'readonly': [('status', '!=', 'draft')]}" options='{"no_open": True, "no_create": True}'/> |
||||
|
<field name="form_view_inherit_id"/> |
||||
|
<field name="tree_field_ids" invisible="1"/> |
||||
|
</group> |
||||
|
<group string="Tree View"> |
||||
|
<field name="is_add_field_in_tree" attrs="{'readonly': [('status', 'not in', ['draft', 'form'])]}"/> |
||||
|
<field name="tree_view_id" options='{"no_open": True, "no_create": True}' attrs="{'invisible': [('is_add_field_in_tree', '=', False)], |
||||
|
'required': [('is_add_field_in_tree', '=', True)],'readonly': [('status', 'not in', ['draft', 'form'])]}"/> |
||||
|
<field name="tree_view_inherit_id" attrs="{'invisible': [('is_add_field_in_tree', '=', False)],'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="tree_field_id" options='{"no_open": True, "no_create": True}' attrs="{'invisible': [('is_add_field_in_tree', '=', False)], |
||||
|
'required': [('is_add_field_in_tree', '=', True)], 'readonly': [('status', 'not in', ['draft', 'form'])]}"/> |
||||
|
<field name="tree_field_position" attrs="{'invisible': [('is_add_field_in_tree', '=', False)], |
||||
|
'required': [('is_add_field_in_tree', '=', True)], 'readonly': [('status', 'not in', ['draft', 'form'])]}"/> |
||||
|
<field name="is_field_in_tree" attrs="{'invisible': [('is_add_field_in_tree', '=', False)], |
||||
|
'required': [('is_add_field_in_tree', '=', True)], 'readonly': [('status', 'not in', ['draft', 'form'])]}"/> |
||||
|
</group> |
||||
|
<group string="Position"> |
||||
|
<field name="position_field_id" options='{"no_open": True, "no_create": True}' attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="position" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
<group string="Extra Properties"> |
||||
|
<group> |
||||
|
<field name="is_extra_features" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
</group> |
||||
|
<group attrs="{'invisible': [('is_extra_features', '=', False)],'readonly': [('status', '!=', 'draft')]}"> |
||||
|
<field name="help"/> |
||||
|
</group> |
||||
|
<group attrs="{'invisible': [('is_extra_features', '=', False)],'readonly': [('status', '!=', 'draft')]}"> |
||||
|
<field name="readonly" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="store" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="index" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
<field name="copied" attrs="{'readonly': [('status', '!=', 'draft')]}"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
</sheet> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Dynamic fields action--> |
||||
|
<record id='dynamic_fields_action' model='ir.actions.act_window'> |
||||
|
<field name="name">Custom Dynamic Fields</field> |
||||
|
<field name="res_model">dynamic.fields</field> |
||||
|
<field name="view_mode">tree,form</field> |
||||
|
<field name="help" type="html"> |
||||
|
<p class="o_view_nocontent_smiling_face"> |
||||
|
Create New Custom Dynamic Field! |
||||
|
</p> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- All in One Custom Dynamic Fields root menu--> |
||||
|
<menuitem id="menu_all_in_one_dynamic_custom_fields_root" |
||||
|
name="All in One Custom Dynamic Fields" |
||||
|
groups="group_all_in_one_dynamic_custom_fields_user,group_all_in_one_dynamic_custom_fields_administrator" |
||||
|
web_icon="all_in_one_dynamic_custom_fields,static/description/icon.png" |
||||
|
sequence="01"/> |
||||
|
<!-- Create custom dynamic fields menu--> |
||||
|
<menuitem id="menu_create_custom_dynamic_fields" |
||||
|
name="Fields" |
||||
|
parent="menu_all_in_one_dynamic_custom_fields_root" |
||||
|
sequence="1"/> |
||||
|
<!-- Create Fields menu--> |
||||
|
<menuitem id="menu_create_fields" |
||||
|
name="Create Fields" |
||||
|
parent="menu_create_custom_dynamic_fields" |
||||
|
action="dynamic_fields_action" |
||||
|
groups="group_all_in_one_dynamic_custom_fields_user,group_all_in_one_dynamic_custom_fields_administrator" |
||||
|
sequence="2"/> |
||||
|
</odoo> |