diff --git a/dynamic_partner_fields/README.rst b/dynamic_partner_fields/README.rst new file mode 100644 index 000000000..ecc288002 --- /dev/null +++ b/dynamic_partner_fields/README.rst @@ -0,0 +1,42 @@ +Partner Custom Fields +====================== + +Partner Custom Fields + +Depends +======= +[sale] addon Odoo + +Tech +==== +* [Python] - Models +* [XML] - Odoo views + +Installation +============ +- www.odoo.com/documentation/12.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_partner_fields/__init__.py b/dynamic_partner_fields/__init__.py new file mode 100644 index 000000000..e2a9ef6af --- /dev/null +++ b/dynamic_partner_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_partner_fields/__manifest__.py b/dynamic_partner_fields/__manifest__.py new file mode 100644 index 000000000..3b4e5ff74 --- /dev/null +++ b/dynamic_partner_fields/__manifest__.py @@ -0,0 +1,46 @@ +# -*- 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': 'Partner Custom Fields', + 'version': '12.0.1.0.0', + 'summary': """Ability To Add Custom Fields in Partner From User Level""", + 'description': """Ability To Add Custom Fields in Partner From User Level.""", + 'category': 'Extra Tools', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['contacts'], + 'data': [ + 'security/ir.model.access.csv', + 'security/contact_security.xml', + 'wizard/partner_fields_view.xml', + 'views/partner_form_view.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/dynamic_partner_fields/doc/RELEASE_NOTES.md b/dynamic_partner_fields/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..269e08462 --- /dev/null +++ b/dynamic_partner_fields/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 21.12.2019 +#### Version 12.0.1.0.0 +#### ADD +Initial Commit for dynamic_partner_fields diff --git a/dynamic_partner_fields/security/contact_security.xml b/dynamic_partner_fields/security/contact_security.xml new file mode 100644 index 000000000..c274c7768 --- /dev/null +++ b/dynamic_partner_fields/security/contact_security.xml @@ -0,0 +1,8 @@ + + + + + Create Custom Fields + + + diff --git a/dynamic_partner_fields/security/ir.model.access.csv b/dynamic_partner_fields/security/ir.model.access.csv new file mode 100644 index 000000000..cdb365ae6 --- /dev/null +++ b/dynamic_partner_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_partner_dynamic_fields_base_user","wizard.partner.dynamic.fields.base.user","model_partner_dynamic_fields","base.group_user",1,1,1,1 + diff --git a/dynamic_partner_fields/static/description/banner.png b/dynamic_partner_fields/static/description/banner.png new file mode 100644 index 000000000..cfe375830 Binary files /dev/null and b/dynamic_partner_fields/static/description/banner.png differ diff --git a/dynamic_partner_fields/static/description/icon.png b/dynamic_partner_fields/static/description/icon.png new file mode 100644 index 000000000..e3bf96c4a Binary files /dev/null and b/dynamic_partner_fields/static/description/icon.png differ diff --git a/dynamic_partner_fields/static/description/images/banner_barcode_scanning.jpeg b/dynamic_partner_fields/static/description/images/banner_barcode_scanning.jpeg new file mode 100644 index 000000000..529143e4e Binary files /dev/null and b/dynamic_partner_fields/static/description/images/banner_barcode_scanning.jpeg differ diff --git a/dynamic_partner_fields/static/description/images/banner_currency_total.png b/dynamic_partner_fields/static/description/images/banner_currency_total.png new file mode 100644 index 000000000..6153ed719 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/banner_currency_total.png differ diff --git a/dynamic_partner_fields/static/description/images/banner_customer_sequence.jpeg b/dynamic_partner_fields/static/description/images/banner_customer_sequence.jpeg new file mode 100644 index 000000000..7451342d6 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/banner_customer_sequence.jpeg differ diff --git a/dynamic_partner_fields/static/description/images/banner_previous_rates.jpeg b/dynamic_partner_fields/static/description/images/banner_previous_rates.jpeg new file mode 100644 index 000000000..e10c28799 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/banner_previous_rates.jpeg differ diff --git a/dynamic_partner_fields/static/description/images/banner_product_branding.png b/dynamic_partner_fields/static/description/images/banner_product_branding.png new file mode 100644 index 000000000..aa12beabb Binary files /dev/null and b/dynamic_partner_fields/static/description/images/banner_product_branding.png differ diff --git a/dynamic_partner_fields/static/description/images/banner_product_expiry.jpeg b/dynamic_partner_fields/static/description/images/banner_product_expiry.jpeg new file mode 100644 index 000000000..84a872d44 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/banner_product_expiry.jpeg differ diff --git a/dynamic_partner_fields/static/description/images/checked.png b/dynamic_partner_fields/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/checked.png differ diff --git a/dynamic_partner_fields/static/description/images/cybrosys.png b/dynamic_partner_fields/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/dynamic_partner_fields/static/description/images/cybrosys.png differ diff --git a/dynamic_partner_fields/static/description/images/dynamic_product_fields_1.png b/dynamic_partner_fields/static/description/images/dynamic_product_fields_1.png new file mode 100644 index 000000000..44667f4b8 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/dynamic_product_fields_1.png differ diff --git a/dynamic_partner_fields/static/description/images/dynamic_product_fields_2.png b/dynamic_partner_fields/static/description/images/dynamic_product_fields_2.png new file mode 100644 index 000000000..a6b541867 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/dynamic_product_fields_2.png differ diff --git a/dynamic_partner_fields/static/description/images/dynamic_product_fields_3.png b/dynamic_partner_fields/static/description/images/dynamic_product_fields_3.png new file mode 100644 index 000000000..920001735 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/dynamic_product_fields_3.png differ diff --git a/dynamic_partner_fields/static/description/images/dynamic_product_fields_4.png b/dynamic_partner_fields/static/description/images/dynamic_product_fields_4.png new file mode 100644 index 000000000..64b7286f5 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/dynamic_product_fields_4.png differ diff --git a/dynamic_partner_fields/static/description/images/dynamic_product_fields_5.png b/dynamic_partner_fields/static/description/images/dynamic_product_fields_5.png new file mode 100644 index 000000000..e2e6dcd72 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/dynamic_product_fields_5.png differ diff --git a/dynamic_partner_fields/static/description/images/dynamic_product_fields_6.png b/dynamic_partner_fields/static/description/images/dynamic_product_fields_6.png new file mode 100644 index 000000000..b1227f983 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/dynamic_product_fields_6.png differ diff --git a/dynamic_partner_fields/static/description/images/dynamic_product_fields_7.png b/dynamic_partner_fields/static/description/images/dynamic_product_fields_7.png new file mode 100644 index 000000000..bb4037d6e Binary files /dev/null and b/dynamic_partner_fields/static/description/images/dynamic_product_fields_7.png differ diff --git a/dynamic_partner_fields/static/description/images/website.gif b/dynamic_partner_fields/static/description/images/website.gif new file mode 100644 index 000000000..b0a9c79c5 Binary files /dev/null and b/dynamic_partner_fields/static/description/images/website.gif differ diff --git a/dynamic_partner_fields/static/description/index.html b/dynamic_partner_fields/static/description/index.html new file mode 100644 index 000000000..9dd0e8151 --- /dev/null +++ b/dynamic_partner_fields/static/description/index.html @@ -0,0 +1,316 @@ +
cybrosys-logo
+
+
+
+

Partner Custom Fields

+

Create Custom Fields on Partner from User level.

+
+

Key Highlights

+
    +
  • checkCreates custom fields on Partner.
  • +
+
+
+
+
+
+
+
+ +
+
+ +

Overview

+
+

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

+
+
+ +

Partner Custom Fields

+
+
    +
  • + checkCreates custom fields on partner 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_partner_fields/views/partner_form_view.xml b/dynamic_partner_fields/views/partner_form_view.xml new file mode 100644 index 000000000..f5856c264 --- /dev/null +++ b/dynamic_partner_fields/views/partner_form_view.xml @@ -0,0 +1,23 @@ + + + + + view.res.partner.form.dynamic.fields + res.partner + + + + + + + + + + diff --git a/dynamic_partner_fields/wizard/__init__.py b/dynamic_partner_fields/wizard/__init__.py new file mode 100644 index 000000000..639e081a5 --- /dev/null +++ b/dynamic_partner_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 partner_fields + + diff --git a/dynamic_partner_fields/wizard/partner_fields.py b/dynamic_partner_fields/wizard/partner_fields.py new file mode 100644 index 000000000..26ea0e6fd --- /dev/null +++ b/dynamic_partner_fields/wizard/partner_fields.py @@ -0,0 +1,102 @@ +# -*- 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 PartnerDynamicFields(models.TransientModel): + _name = 'partner.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('base.view_partner_form') + view_arch = str(view_id.arch_base) + doc = xee.fromstring(view_arch) + + field_list = [] + for tag in doc.findall('.//field'): + if tag.attrib.get('invisible'): + print(tag.attrib.get('invisible')) + pass + else: + field_list.append(tag.attrib['name']) + + model_id = self.env['ir.model'].sudo().search([('model', '=', 'res.partner')]) + 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', '=', 'res.partner')]) + 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('base.view_partner_form') + arch_base = _('' + '' + '' + '' + '' + '') % (self.position_field.name, self.position, self.name) + self.env['ir.ui.view'].sudo().create({'name': 'partner.dynamic.fields', + 'type': 'form', + 'model': 'res.partner', + '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_partner_fields/wizard/partner_fields_view.xml b/dynamic_partner_fields/wizard/partner_fields_view.xml new file mode 100644 index 000000000..23bf54671 --- /dev/null +++ b/dynamic_partner_fields/wizard/partner_fields_view.xml @@ -0,0 +1,50 @@ + + + + + partner.dynamic.fields.form + partner.dynamic.fields + +
+ + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Create Custom Fields + partner.dynamic.fields + form + form + + new + + +