diff --git a/auto_fill/README.rst b/auto_fill/README.rst new file mode 100755 index 000000000..2956b8ff0 --- /dev/null +++ b/auto_fill/README.rst @@ -0,0 +1,13 @@ +Auto Fill Widget +================ +* Widget that suggests field value in existing records +* Widget = **auto_fill** + +Developer +========= +* Developer: + odoo v11 Avinash Nk (odoo@cybrosys.com) + odoo v12 Akshay Babu +Contacts +======== +* Cybrosys Technologies diff --git a/auto_fill/__init__.py b/auto_fill/__init__.py new file mode 100755 index 000000000..a7d50eeee --- /dev/null +++ b/auto_fill/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Avinash Nk() +# +# 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 controllers diff --git a/auto_fill/__manifest__.py b/auto_fill/__manifest__.py new file mode 100755 index 000000000..b6f53815a --- /dev/null +++ b/auto_fill/__manifest__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Avinash Nk() +# +# 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': 'Auto Fill Widget', + 'version': '12.0.1.0.0', + 'summary': """Widget that suggests field value from existing records""", + 'description': 'Widget for auto completing a character field according to its existing record values', + 'category': 'Extra Tools', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base'], + 'qweb': ['static/src/xml/auto_fill.xml'], + 'data': ['views/auto_fill_templates.xml'], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/auto_fill/controllers/__init__.py b/auto_fill/controllers/__init__.py new file mode 100755 index 000000000..e56d9d4e0 --- /dev/null +++ b/auto_fill/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Avinash Nk() +# +# 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 main diff --git a/auto_fill/controllers/main.py b/auto_fill/controllers/main.py new file mode 100755 index 000000000..a98f1d8a9 --- /dev/null +++ b/auto_fill/controllers/main.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Avinash Nk() +# +# 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 odoo.http import request +from odoo import http + + +class GetMatchingRecords(http.Controller): + + @http.route(['/matching/records'], type='json', auth="none") + def get_matching_records(self, **kwargs): + model = str(kwargs['model']) + field = str(kwargs['field']) + value = str(kwargs['value']) + model = model.replace(".", "_") + cr = request.cr + if len(value) > 0: + query = """SELECT %s FROM %s WHERE %s ~* '%s' GROUP BY %s""" % (field, model, field, value, field) + cr.execute(query) + res = cr.fetchall() + else: + res = [] + return res diff --git a/auto_fill/doc/RELEASE_NOTES.md b/auto_fill/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..6be164058 --- /dev/null +++ b/auto_fill/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 30.04.2019 +#### Version 12.0.1.0.0 +##### ADD +- Initial Commit diff --git a/auto_fill/static/description/auto_fill.gif b/auto_fill/static/description/auto_fill.gif new file mode 100644 index 000000000..d8c354343 Binary files /dev/null and b/auto_fill/static/description/auto_fill.gif differ diff --git a/auto_fill/static/description/banner.jpg b/auto_fill/static/description/banner.jpg new file mode 100755 index 000000000..434e8bfe3 Binary files /dev/null and b/auto_fill/static/description/banner.jpg differ diff --git a/auto_fill/static/description/cybro_logo.png b/auto_fill/static/description/cybro_logo.png new file mode 100755 index 000000000..bb309114c Binary files /dev/null and b/auto_fill/static/description/cybro_logo.png differ diff --git a/auto_fill/static/description/icon.png b/auto_fill/static/description/icon.png new file mode 100755 index 000000000..538cbf146 Binary files /dev/null and b/auto_fill/static/description/icon.png differ diff --git a/auto_fill/static/description/index.html b/auto_fill/static/description/index.html new file mode 100755 index 000000000..c8659db0d --- /dev/null +++ b/auto_fill/static/description/index.html @@ -0,0 +1,337 @@ +
+
+

+ Auto Fill Widget +

+

+ Widget that suggests field value from existing records +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies +
+
+
+
+ +
+
+

+ Overview +

+

+ Widget for auto completing a character field according to its existing record values. +

+

+ Configuration +

+

+ After installing the module, you can put the tag widget="auto_fill" in your form view. +

+
+
+ +
+
+

+ Features +

+

+ + Can insert any character or text fields. +

+

+ + Very fast result. +

+

+ + Attractive design. +

+

+ + Widget = auto_fill. +

+
+
+ +
+
+
+

Drill-down

+
+ +
+
+
+
+ +
+
+ cybrosys technologies +
+
+ +
+
+

+ Our Services +

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

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/auto_fill/static/src/css/auto_fill.css b/auto_fill/static/src/css/auto_fill.css new file mode 100755 index 000000000..62b1e0e4d --- /dev/null +++ b/auto_fill/static/src/css/auto_fill.css @@ -0,0 +1,32 @@ +.auto-fill-scrollbar { + z-index: 1051; + position: absolute; + background: #ffffff; + overflow-y: scroll; + height: auto; + display:none; + width:auto !important; + border: 1px solid #E5E5E5; + font-size: 13px; + padding: 5px 0px; + box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.176); +} +.auto-fill-scrollbar td { + padding-left: 7px !important; + padding-right: 7px !important; +} +.auto-fill-scrollbar td:hover{ + background: #2d6cb3; + color: #fff; + width: 5px; +} +.list_matches{ + width: 100%; + cursor: pointer; +} +.input_field_auto_fill { + border: 1px solid #D2D2FF; +} +.text_field_auto_fill { + border: 1px solid #D2D2FF; +} diff --git a/auto_fill/static/src/js/auto_fill.js b/auto_fill/static/src/js/auto_fill.js new file mode 100755 index 000000000..6073b3965 --- /dev/null +++ b/auto_fill/static/src/js/auto_fill.js @@ -0,0 +1,53 @@ +odoo.define('auto_fill.AutoFill', function (require) { + "use strict"; + + var ajax = require('web.ajax'); + var basic_fields = require('web.basic_fields'); + var registry = require('web.field_registry'); + var CharField = registry.get('char'); + + var FieldAutoFill = CharField.extend({ + template: 'FieldAutoFill', + events: _.extend({}, CharField.prototype.events, { + 'keyup': '_onKeyup', + 'click #list_matches': '_onTableRowClicked', + }), + + _onKeyup: function () { + var value = document.getElementsByClassName('input_field_auto_fill')[0].value; + ajax.jsonRpc('/matching/records', 'call', { + model: this.model, + field: this.name, + value: value, + }).then(function (result){ + if (result.length > 0){ + $('.auto-fill-scrollbar').css('display', 'block'); + var table = document.getElementById("list_matches"); + $("#list_matches tr").remove(); + var i; + for (i = 0; i < result.length; i++) { + var row = table.insertRow(i); + var cell = row.insertCell(0); + cell.innerHTML = result[i]; + } + } + else { + $('.auto-fill-scrollbar').css('display', 'none'); + } + }) ; + }, + + _onTableRowClicked: function (ev) { + document.getElementsByClassName('input_field_auto_fill')[0].value = ev.target.textContent; + $('.auto-fill-scrollbar').css('display', 'none'); + }, + + }); + + registry.add('auto_fill', FieldAutoFill); + + return { + FieldAutoFill: FieldAutoFill, + }; + +}); diff --git a/auto_fill/static/src/xml/auto_fill.xml b/auto_fill/static/src/xml/auto_fill.xml new file mode 100755 index 000000000..f34bdc2d6 --- /dev/null +++ b/auto_fill/static/src/xml/auto_fill.xml @@ -0,0 +1,17 @@ + + + + + + + + +