diff --git a/dynamic_product_fields/README.rst b/dynamic_product_fields/README.rst new file mode 100644 index 000000000..ffc63b73e --- /dev/null +++ b/dynamic_product_fields/README.rst @@ -0,0 +1,42 @@ +Product Dynamic Fields +======================= + +Product Dynamic Fields + +Depends +======= +[sale] addon Odoo + +Tech +==== +* [Python] - Models +* [XML] - Odoo views + +Installation +============ +- www.odoo.com/documentation/11.0/setup/install.html +- Install our custom addon + +License +======= +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl.html) + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Credits +======= +* Cybrosys Techno Solutions + +Author +------ +Cybrosys Technologies + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. diff --git a/dynamic_product_fields/__init__.py b/dynamic_product_fields/__init__.py new file mode 100644 index 000000000..e2a9ef6af --- /dev/null +++ b/dynamic_product_fields/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies (). +# Author: Cybrosys Technologies () +# +# 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 . +# +################################################################################### + +from . import wizard diff --git a/dynamic_product_fields/__manifest__.py b/dynamic_product_fields/__manifest__.py new file mode 100644 index 000000000..04a36bacd --- /dev/null +++ b/dynamic_product_fields/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies (). +# Author: Cybrosys Technologies () +# +# 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 . +# +################################################################################### + +{ + 'name': 'Product Custom Fields', + 'version': '12.0.1.0.0', + 'summary': """Ability To Add Custom Fields in Products From User Level""", + 'description': """Ability To Add Custom Fields in Products From User Level.""", + 'category': 'Sales', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['product', 'sale'], + 'data': [ + 'security/ir.model.access.csv', + 'wizard/product_fields_view.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/dynamic_product_fields/security/ir.model.access.csv b/dynamic_product_fields/security/ir.model.access.csv new file mode 100644 index 000000000..a59e1a715 --- /dev/null +++ b/dynamic_product_fields/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +"access_wizard_dynamic_fields_sale_manager","wizard.dynamic.fields.sale_manager","model_product_dynamic_fields","sales_team.group_sale_manager",1,1,1,1 + diff --git a/dynamic_product_fields/static/description/banner.png b/dynamic_product_fields/static/description/banner.png new file mode 100644 index 000000000..0b87b5eb5 Binary files /dev/null and b/dynamic_product_fields/static/description/banner.png differ diff --git a/dynamic_product_fields/static/description/icon.png b/dynamic_product_fields/static/description/icon.png new file mode 100644 index 000000000..d9c4fbeed Binary files /dev/null and b/dynamic_product_fields/static/description/icon.png differ diff --git a/dynamic_product_fields/static/description/images/banner_barcode_scanning.jpeg b/dynamic_product_fields/static/description/images/banner_barcode_scanning.jpeg new file mode 100644 index 000000000..529143e4e Binary files /dev/null and b/dynamic_product_fields/static/description/images/banner_barcode_scanning.jpeg differ diff --git a/dynamic_product_fields/static/description/images/banner_currency_total.png b/dynamic_product_fields/static/description/images/banner_currency_total.png new file mode 100644 index 000000000..6153ed719 Binary files /dev/null and b/dynamic_product_fields/static/description/images/banner_currency_total.png differ diff --git a/dynamic_product_fields/static/description/images/banner_customer_sequence.jpeg b/dynamic_product_fields/static/description/images/banner_customer_sequence.jpeg new file mode 100644 index 000000000..7451342d6 Binary files /dev/null and b/dynamic_product_fields/static/description/images/banner_customer_sequence.jpeg differ diff --git a/dynamic_product_fields/static/description/images/banner_previous_rates.jpeg b/dynamic_product_fields/static/description/images/banner_previous_rates.jpeg new file mode 100644 index 000000000..e10c28799 Binary files /dev/null and b/dynamic_product_fields/static/description/images/banner_previous_rates.jpeg differ diff --git a/dynamic_product_fields/static/description/images/banner_product_branding.png b/dynamic_product_fields/static/description/images/banner_product_branding.png new file mode 100644 index 000000000..aa12beabb Binary files /dev/null and b/dynamic_product_fields/static/description/images/banner_product_branding.png differ diff --git a/dynamic_product_fields/static/description/images/banner_product_expiry.jpeg b/dynamic_product_fields/static/description/images/banner_product_expiry.jpeg new file mode 100644 index 000000000..84a872d44 Binary files /dev/null and b/dynamic_product_fields/static/description/images/banner_product_expiry.jpeg differ diff --git a/dynamic_product_fields/static/description/images/checked.png b/dynamic_product_fields/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/dynamic_product_fields/static/description/images/checked.png differ diff --git a/dynamic_product_fields/static/description/images/cybrosys.png b/dynamic_product_fields/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/dynamic_product_fields/static/description/images/cybrosys.png differ diff --git a/dynamic_product_fields/static/description/images/dynamic_product_fields_1.png b/dynamic_product_fields/static/description/images/dynamic_product_fields_1.png new file mode 100644 index 000000000..e1d03ee2d Binary files /dev/null and b/dynamic_product_fields/static/description/images/dynamic_product_fields_1.png differ diff --git a/dynamic_product_fields/static/description/images/dynamic_product_fields_2.png b/dynamic_product_fields/static/description/images/dynamic_product_fields_2.png new file mode 100644 index 000000000..a6b541867 Binary files /dev/null and b/dynamic_product_fields/static/description/images/dynamic_product_fields_2.png differ diff --git a/dynamic_product_fields/static/description/images/dynamic_product_fields_3.png b/dynamic_product_fields/static/description/images/dynamic_product_fields_3.png new file mode 100644 index 000000000..e55d47024 Binary files /dev/null and b/dynamic_product_fields/static/description/images/dynamic_product_fields_3.png differ diff --git a/dynamic_product_fields/static/description/images/dynamic_product_fields_4.png b/dynamic_product_fields/static/description/images/dynamic_product_fields_4.png new file mode 100644 index 000000000..64b7286f5 Binary files /dev/null and b/dynamic_product_fields/static/description/images/dynamic_product_fields_4.png differ diff --git a/dynamic_product_fields/static/description/images/dynamic_product_fields_5.png b/dynamic_product_fields/static/description/images/dynamic_product_fields_5.png new file mode 100644 index 000000000..e2e6dcd72 Binary files /dev/null and b/dynamic_product_fields/static/description/images/dynamic_product_fields_5.png differ diff --git a/dynamic_product_fields/static/description/images/dynamic_product_fields_6.png b/dynamic_product_fields/static/description/images/dynamic_product_fields_6.png new file mode 100644 index 000000000..af967904e Binary files /dev/null and b/dynamic_product_fields/static/description/images/dynamic_product_fields_6.png differ diff --git a/dynamic_product_fields/static/description/images/website.gif b/dynamic_product_fields/static/description/images/website.gif new file mode 100644 index 000000000..b0a9c79c5 Binary files /dev/null and b/dynamic_product_fields/static/description/images/website.gif differ diff --git a/dynamic_product_fields/static/description/index.html b/dynamic_product_fields/static/description/index.html new file mode 100644 index 000000000..d08fd68d9 --- /dev/null +++ b/dynamic_product_fields/static/description/index.html @@ -0,0 +1,328 @@ +
cybrosys-logo
+
+
+
+

Product Custom Fields

+

Create Custom Fields on Products from User level.

+
+

Key Highlights

+
    +
  • checkCreates custom fields on Products.
  • +
+
+
+
+
+
+
+
+ +
+
+ +

Overview

+
+

+ The Dynamic Product Fields helps to create a custom fields on product simply and easily without coding. This module helps to add a new fields on products form and save it. From configuration menu you click create fields and you can create new custom field as per your needs without coding. +

+
+
+ +

Dynamic Product Fields

+
+
    +
  • + checkCreates custom fields on product without coding +
  • +
  • + checkCan easily set the position of fields +
  • +
  • + checkCan set the field is required or not and the type of field. +
  • +
+
+ +
+
+

Screenshots

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

Suggested Products

+
+ +
+
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+ +
+
+

Trading

+

Easily procure and sell your products.

+
+
+
+
+ +
+
+

Manufacturing

+

Plan, track and schedule your operations.

+
+
+
+
+ +
+
+

Restaurant

+

Run your bar or restaurant methodical.

+
+
+
+
+ +
+
+

POS

+

Easy configuring and convivial selling.

+
+
+
+
+ +
+
+

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages.

+
+
+
+
+ +
+
+

Hotel Management

+

An all-inclusive hotel management application.

+
+
+
+
+ +
+
+

Education

+

A Collaborative platform for educational management.

+
+
+
+
+ +
+
+

Service Management

+

Keep track of services and invoice accordingly.

+
+
+
+
+
+ +
+
+
+

Need Any Help?

+
+

If you have anything to share with us based on your use of this module, please let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com / info@cybrosys.com

+
+
+

Contact Us

+ www.cybrosys.com +
+
+
+
+
+
+
+
+
+ +
+ + + + + + + +
+
+
+ \ No newline at end of file diff --git a/dynamic_product_fields/wizard/__init__.py b/dynamic_product_fields/wizard/__init__.py new file mode 100644 index 000000000..d3b7499c2 --- /dev/null +++ b/dynamic_product_fields/wizard/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies (). +# Author: Cybrosys Technologies () +# +# 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 . +# +################################################################################### + +from . import product_fields + + diff --git a/dynamic_product_fields/wizard/product_fields.py b/dynamic_product_fields/wizard/product_fields.py new file mode 100644 index 000000000..95e9d226c --- /dev/null +++ b/dynamic_product_fields/wizard/product_fields.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies (). +# Author: Cybrosys Technologies () +# +# 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 . +# +################################################################################### + +import xml.etree.ElementTree as xee +from odoo import api, models, fields, _ + + +class ProductDynamicFields(models.TransientModel): + _name = 'product.dynamic.fields' + _description = 'Dynamic Fields' + _inherit = 'ir.model.fields' + + @api.model + def get_possible_field_types(self): + """Return all available field types other than 'one2many' and 'reference' fields.""" + field_list = sorted((key, key) for key in fields.MetaField.by_type) + field_list.remove(('one2many', 'one2many')) + field_list.remove(('reference', 'reference')) + return field_list + + @api.multi + def set_domain(self): + """Return the fields that currently present in the form""" + view_id = self.env.ref('product.product_template_only_form_view') + view_arch = str(view_id.arch_base) + doc = xee.fromstring(view_arch) + field_list = [] + for tag in doc.findall('.//field'): + field_list.append(tag.attrib['name']) + model_id = self.env['ir.model'].sudo().search([('model', '=', 'product.template')]) + return [('model_id', '=', model_id.id), ('state', '=', 'base'), ('name', 'in', field_list)] + + @api.multi + def _set_default(self): + model_id = self.env['ir.model'].sudo().search([('model', '=', 'product.template')]) + return [('id', '=', model_id.id)] + + @api.multi + def create_fields(self): + self.env['ir.model.fields'].sudo().create({'name': self.name, + 'field_description': self.field_description, + 'model_id': self.model_id.id, + 'ttype': self.ttype, + 'relation': self.ref_model_id.model, + 'required': self.required, + 'selection': self.selection, + 'copy': self.copy, + 'active': True}) + inherit_id = self.env.ref('product.product_template_only_form_view') + arch_base = _('' + '' + '' + '' + '' + '') % (self.position_field.name, self.position, self.name) + self.env['ir.ui.view'].sudo().create({'name': 'product.dynamic.fields', + 'type': 'form', + 'model': 'product.template', + 'mode': 'extension', + 'inherit_id': inherit_id.id, + 'arch_base': arch_base, + 'active': True}) + return { + 'type': 'ir.actions.client', + 'tag': 'reload', + } + + position_field = fields.Many2one('ir.model.fields', string='Field Name', + domain=set_domain, required=True) + position = fields.Selection([('before', 'Before'), + ('after', 'After')], string='Position', required=True) + model_id = fields.Many2one('ir.model', string='Model', required=True, index=True, ondelete='cascade', + help="The model this field belongs to", domain=_set_default) + ref_model_id = fields.Many2one('ir.model', string='Model', index=True) + rel_field = fields.Many2one('ir.model.fields', string='Related Field') + ttype = fields.Selection(selection='get_possible_field_types', string='Field Type', required=True) diff --git a/dynamic_product_fields/wizard/product_fields_view.xml b/dynamic_product_fields/wizard/product_fields_view.xml new file mode 100644 index 000000000..4d1e218aa --- /dev/null +++ b/dynamic_product_fields/wizard/product_fields_view.xml @@ -0,0 +1,54 @@ + + + + + product.dynamic.fields.form + product.dynamic.fields + +
+ + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Create Custom Fields + product.dynamic.fields + form + form + + new + + + + +