diff --git a/product_image_suggestion/README.rst b/product_image_suggestion/README.rst new file mode 100644 index 000000000..da3facc92 --- /dev/null +++ b/product_image_suggestion/README.rst @@ -0,0 +1,61 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Product Image Suggestion +======================== + +This module shortlists you with the most relevant product images on Bing Images that you are precisely looking for. + +Installation +============ + +- www.odoo.com/documentation/15.0/setup/install.html +- Install our custom addon + +Configuration +============= + +* Before going to install, make sure "PIL" and "python-resize-image" python packages are installed on your server +* Linux commands to install packages - ('pip install pillow', 'pip install python-resize-image') +* After installing the module, go to product form. Search product image from page "Image suggestion". +* Use image number limit for searching. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +======= +GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Credits +======= +* Developer: (V15) RAHUL C K , Contact: 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 https://www.cybrosys.com. + +Further information +=================== +HTML Description: ``__ diff --git a/product_image_suggestion/__init__.py b/product_image_suggestion/__init__.py new file mode 100644 index 000000000..e3b39c260 --- /dev/null +++ b/product_image_suggestion/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +from . import models +from . import wizard diff --git a/product_image_suggestion/__manifest__.py b/product_image_suggestion/__manifest__.py new file mode 100644 index 000000000..be503af65 --- /dev/null +++ b/product_image_suggestion/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +{ + 'name': 'Product Image Suggestion', + 'version': '15.0.1.0.0', + 'category': 'Productivity', + 'summary': """Suggest product images from Bing search""", + 'description': """Product images can be searched from the product form + using bing image downloader and it can be set as the product display image. + """, + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'product'], + 'data': [ + 'security/ir.model.access.csv', + 'views/product_template_views.xml', + ], + 'external_dependencies': {'python': ['PIL', 'resizeimage']}, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/product_image_suggestion/doc/RELEASE_NOTES.md b/product_image_suggestion/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..0bc12dafa --- /dev/null +++ b/product_image_suggestion/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 21.08.2023 +#### Version 15.0.1.0.0 +#### ADD +- Initial commit for Product Image Suggestion diff --git a/product_image_suggestion/models/__init__.py b/product_image_suggestion/models/__init__.py new file mode 100644 index 000000000..c6f4703a7 --- /dev/null +++ b/product_image_suggestion/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +from . import bing +from . import downloader +from . import product_template diff --git a/product_image_suggestion/models/bing.py b/product_image_suggestion/models/bing.py new file mode 100644 index 000000000..36245e6c2 --- /dev/null +++ b/product_image_suggestion/models/bing.py @@ -0,0 +1,120 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +import imghdr +import posixpath +import re +import urllib +import urllib.request + + +class Bing: + def __init__(self, query, limit, output_dir, adult, timeout, filter='', + verbose=True): + self.download_count = 0 + self.query = query + self.output_dir = output_dir + self.adult = adult + self.filter = filter + self.verbose = verbose + self.seen = set() + + assert type(limit) == int, "limit must be integer" + self.limit = limit + assert type(timeout) == int, "timeout must be integer" + self.timeout = timeout + + self.page_counter = 0 + self.headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) ' + 'AppleWebKit/537.11 (KHTML, like Gecko) ' + 'Chrome/23.0.1271.64 Safari/537.11', + 'Accept': 'text/html,application/xhtml+xml,' + 'application/xml;q=0.9,*/*;q=0.8', + 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', + 'Accept-Encoding': 'none', + 'Accept-Language': 'en-US,en;q=0.8', + 'Connection': 'keep-alive'} + + def get_filter(self, shorthand): + if shorthand == "line" or shorthand == "linedrawing": + return "+filterui:photo-linedrawing" + elif shorthand == "photo": + return "+filterui:photo-photo" + elif shorthand == "clipart": + return "+filterui:photo-clipart" + elif shorthand == "gif" or shorthand == "animatedgif": + return "+filterui:photo-animatedgif" + elif shorthand == "transparent": + return "+filterui:photo-transparent" + else: + return "" + + def save_image(self, link, file_path): + request = urllib.request.Request(link, None, self.headers) + image = urllib.request.urlopen(request, timeout=self.timeout).read() + if not imghdr.what(None, image): + raise ValueError('Invalid image, not saving {}\n'.format(link)) + with open(str(file_path), 'wb') as f: + f.write(image) + + def download_image(self, link): + self.download_count += 1 + try: + path = urllib.parse.urlsplit(link).path + filename = posixpath.basename(path).split('?')[0] + file_type = filename.split(".")[-1] + if file_type.lower() not in ["jpe", "jpeg", "jfif", "exif", "tiff", + "gif", "bmp", "png", "webp", "jpg"]: + file_type = "jpg" + + self.save_image(link, self.output_dir.joinpath("Image_{}.{}".format( + str(self.download_count), file_type))) + if self.verbose: + return link + + except Exception as e: + self.download_count -= 1 + self.seen.remove(link) + + def run(self): + while self.download_count < self.limit: + request_url = 'https://www.bing.com/images/async?q=' \ + + urllib.parse.quote_plus(self.query) \ + + '&first=' + str(self.page_counter) + '&count=' \ + + str(self.limit) \ + + '&adlt=' + self.adult + '&qft=' + ( + '' if self.filter is None else self.get_filter( + self.filter)) + request = urllib.request.Request(request_url, None, + headers=self.headers) + response = urllib.request.urlopen(request) + html = response.read().decode('utf8') + if html == "": + break + links = re.findall('murl":"(.*?)"', html) + + for link in links: + if self.download_count < self.limit and link not in self.seen: + self.seen.add(link) + self.download_image(link) + + self.page_counter += 1 + return self.seen diff --git a/product_image_suggestion/models/downloader.py b/product_image_suggestion/models/downloader.py new file mode 100644 index 000000000..60af05e0e --- /dev/null +++ b/product_image_suggestion/models/downloader.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +import shutil +import sys +from pathlib import Path + +try: + from bing import Bing +except ImportError: + from .bing import Bing + + +def download(query, limit=100, output_dir='dataset', adult_filter_off=True, + force_replace=False, timeout=60, filter="", verbose=True): + if adult_filter_off: + adult = 'off' + else: + adult = 'on' + + image_dir = Path(output_dir).joinpath(query).absolute() + + if force_replace: + if Path.isdir(image_dir): + shutil.rmtree(image_dir) + + try: + if not Path.is_dir(image_dir): + Path.mkdir(image_dir, parents=True) + + except Exception as e: + sys.exit(1) + + bing = Bing(query, limit, image_dir, adult, timeout, filter, verbose) + return bing.run() diff --git a/product_image_suggestion/models/product_template.py b/product_image_suggestion/models/product_template.py new file mode 100644 index 000000000..1599b1126 --- /dev/null +++ b/product_image_suggestion/models/product_template.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +import base64 +import logging +import os +import tempfile +import requests +from PIL import Image +from resizeimage import resizeimage +from odoo import api, fields, models, _ +from odoo.exceptions import UserError +from . import downloader + +_logger = logging.getLogger(__name__) + + +class ProductTemplate(models.Model): + """ + Inherited product template to add new fields to show the downloaded image + and set an image as product image. + """ + _inherit = 'product.template' + + search_image_ids = fields.One2many('product.image.suggestion', + 'product_tmpl_id', string='Images', + readonly=True, + help="To show the images downloaded") + search_field = fields.Char(string='Search Text', + help="Type the text to be searched") + image_limit = fields.Integer(string='Limit', default=5, + help="Limit of images to display") + resize_image = fields.Boolean(string='Resize Image', default=True, + help="Resize the image") + + @api.onchange('image_limit') + def _onchange_image_limit(self): + """ + Check if the searched image limit is greater than 10 and a warning + message will be raised. + """ + if self.image_limit > 10: + raise UserError(_('This may slow down image search..!!!')) + + def action_search_image(self): + """Clear search images and add new search""" + for rec in self: + rec.search_image_ids = [[5, 0, 0]] + if rec.image_limit > 10: + _logger.warning("High limit number slow down the image " + "searches") + try: + query_string = rec.search_field.replace(" ", "_").replace(",", + "_") + # Search the images from bing using download function from + # downloader file + image_datas = downloader.download(query_string, + limit=rec.image_limit, + output_dir='dataset', + adult_filter_off=False, + timeout=60, verbose=True) + except: + raise UserError(_('No internet connection available or ' + 'Something wrong !')) + if image_datas: + for img in image_datas: + temp_name = '' + try: + img_request = requests.get(img.strip()).content + # If resize image is enabled, downloaded images will be + # resized and shown in view. + if self.resize_image: + temp_file, temp_name = tempfile.mkstemp( + suffix='.png') + file = open(temp_name, "wb") + file.write(img_request) + file.close() + img_data = resizeimage.resize_contain( + Image.open(temp_name), [1024, 1024]) + img_data.save(temp_name, img_data.format) + with open(temp_name, "rb") as image_file: + binary_image = base64.b64encode( + image_file.read()) + else: + binary_image = \ + base64.b64encode(bytearray(img_request)) + self.env['product.image.suggestion'].create({ + 'image': binary_image, + 'product_tmpl_id': rec.id + }) + if self.resize_image: + os.remove(temp_name) + except: + _logger.exception(_("failed to display in page")) + continue + else: + raise UserError(_('No image suggestions for this image')) diff --git a/product_image_suggestion/security/ir.model.access.csv b/product_image_suggestion/security/ir.model.access.csv new file mode 100644 index 000000000..979d5ab27 --- /dev/null +++ b/product_image_suggestion/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_image_suggestion,access.image.suggestion,model_product_image_suggestion,base.group_user,1,1,1,1 diff --git a/product_image_suggestion/static/description/assets/icons/check.png b/product_image_suggestion/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/check.png differ diff --git a/product_image_suggestion/static/description/assets/icons/cogs.png b/product_image_suggestion/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/cogs.png differ diff --git a/product_image_suggestion/static/description/assets/icons/consultation.png b/product_image_suggestion/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/consultation.png differ diff --git a/product_image_suggestion/static/description/assets/icons/ecom-black.png b/product_image_suggestion/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/ecom-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/education-black.png b/product_image_suggestion/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/education-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/hotel-black.png b/product_image_suggestion/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/hotel-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/license.png b/product_image_suggestion/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/license.png differ diff --git a/product_image_suggestion/static/description/assets/icons/lifebuoy.png b/product_image_suggestion/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/lifebuoy.png differ diff --git a/product_image_suggestion/static/description/assets/icons/logo.png b/product_image_suggestion/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/logo.png differ diff --git a/product_image_suggestion/static/description/assets/icons/manufacturing-black.png b/product_image_suggestion/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/manufacturing-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/pos-black.png b/product_image_suggestion/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/pos-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/puzzle.png b/product_image_suggestion/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/puzzle.png differ diff --git a/product_image_suggestion/static/description/assets/icons/restaurant-black.png b/product_image_suggestion/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/restaurant-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/service-black.png b/product_image_suggestion/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/service-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/trading-black.png b/product_image_suggestion/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/trading-black.png differ diff --git a/product_image_suggestion/static/description/assets/icons/training.png b/product_image_suggestion/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/training.png differ diff --git a/product_image_suggestion/static/description/assets/icons/update.png b/product_image_suggestion/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/update.png differ diff --git a/product_image_suggestion/static/description/assets/icons/user.png b/product_image_suggestion/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/user.png differ diff --git a/product_image_suggestion/static/description/assets/icons/wrench.png b/product_image_suggestion/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/wrench.png differ diff --git a/product_image_suggestion/static/description/assets/modules/image_1.png b/product_image_suggestion/static/description/assets/modules/image_1.png new file mode 100644 index 000000000..b50130c7d Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/image_1.png differ diff --git a/product_image_suggestion/static/description/assets/modules/image_2.png b/product_image_suggestion/static/description/assets/modules/image_2.png new file mode 100644 index 000000000..3ad04ecfd Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/image_2.png differ diff --git a/product_image_suggestion/static/description/assets/modules/image_3.png b/product_image_suggestion/static/description/assets/modules/image_3.png new file mode 100644 index 000000000..30ad58232 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/image_3.png differ diff --git a/product_image_suggestion/static/description/assets/modules/image_4.png b/product_image_suggestion/static/description/assets/modules/image_4.png new file mode 100644 index 000000000..3dc1faa62 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/image_4.png differ diff --git a/product_image_suggestion/static/description/assets/modules/image_5.png b/product_image_suggestion/static/description/assets/modules/image_5.png new file mode 100644 index 000000000..922179d26 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/image_5.png differ diff --git a/product_image_suggestion/static/description/assets/modules/image_6.png b/product_image_suggestion/static/description/assets/modules/image_6.png new file mode 100644 index 000000000..74a88ae60 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/image_6.png differ diff --git a/product_image_suggestion/static/description/assets/screenshots/hero.gif b/product_image_suggestion/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..29a4e9b82 Binary files /dev/null and b/product_image_suggestion/static/description/assets/screenshots/hero.gif differ diff --git a/product_image_suggestion/static/description/assets/screenshots/image_1.png b/product_image_suggestion/static/description/assets/screenshots/image_1.png new file mode 100644 index 000000000..5705cc1d3 Binary files /dev/null and b/product_image_suggestion/static/description/assets/screenshots/image_1.png differ diff --git a/product_image_suggestion/static/description/assets/screenshots/image_2.png b/product_image_suggestion/static/description/assets/screenshots/image_2.png new file mode 100644 index 000000000..3601cfa24 Binary files /dev/null and b/product_image_suggestion/static/description/assets/screenshots/image_2.png differ diff --git a/product_image_suggestion/static/description/assets/screenshots/image_3.png b/product_image_suggestion/static/description/assets/screenshots/image_3.png new file mode 100644 index 000000000..529e4c6c5 Binary files /dev/null and b/product_image_suggestion/static/description/assets/screenshots/image_3.png differ diff --git a/product_image_suggestion/static/description/banner.png b/product_image_suggestion/static/description/banner.png new file mode 100644 index 000000000..996801f09 Binary files /dev/null and b/product_image_suggestion/static/description/banner.png differ diff --git a/product_image_suggestion/static/description/cybro_logo.png b/product_image_suggestion/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/product_image_suggestion/static/description/cybro_logo.png differ diff --git a/product_image_suggestion/static/description/icon.png b/product_image_suggestion/static/description/icon.png new file mode 100644 index 000000000..6045ccfff Binary files /dev/null and b/product_image_suggestion/static/description/icon.png differ diff --git a/product_image_suggestion/static/description/index.html b/product_image_suggestion/static/description/index.html new file mode 100644 index 000000000..1d8eea51e --- /dev/null +++ b/product_image_suggestion/static/description/index.html @@ -0,0 +1,596 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+
+

+ Product Image Suggestion

+

+ An Effective and User Friendly Method of Suggesting Product Images Via Web Downloads +

+ +
+
+ + + + +
+
+

+ Overview +

+
+ +
+

+ This module allows you to search for product images from the bing web browser + and suggestions will be shown in the product form. +

+ +
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Community & Enterprise Support

+

+ Available in Odoo 15.0 Community and Enterprise.

+
+
+
+
+ +
+
+

+ Product Image Suggestion

+

+ Provide the product name to be searched in the search box and limit of images to display.

+

+ On click on the search icon, system will search for the image from the Bing browser.

+

+ The downloaded images will be shown in the product form.

+

+ Images will be converted to 1024x1024 px when 'resize image' is enabled.

+
+
+ +
+ +
+
+

+ Screenshots +

+
+
+

+ Product Form

+

+ New page 'Image Suggestion' is added +

+
+ +
+ +
+

+ Limit - Maximum number of images to be downloaded. +

+
+

+ Resize Image - Enable this field to automatically convert downloaded images to 1024x1024 px. +

+
+

+ Search Field - Enter the text of image to be searched and click on search icon to search images from the web. +

+
+ + +
+ +
+

+ The searched images will be shown as tiles in the form.
+ By clicking on 'SET' button the corresponding image can be set as display image of product. +

+ +
+ +
+ + + +
+
+

Suggested Products

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

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

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

Need Help?

+
+
+
+ + +
+ +
+ +
+ +
+ WhatsApp +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/product_image_suggestion/views/product_template_views.xml b/product_image_suggestion/views/product_template_views.xml new file mode 100644 index 000000000..32dc2a4f2 --- /dev/null +++ b/product_image_suggestion/views/product_template_views.xml @@ -0,0 +1,59 @@ + + + + + + product.template.view.form.inherit.product.image.suggestion + + product.template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_image_suggestion/wizard/__init__.py b/product_image_suggestion/wizard/__init__.py new file mode 100644 index 000000000..15989790b --- /dev/null +++ b/product_image_suggestion/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +from . import product_image_suggestion diff --git a/product_image_suggestion/wizard/product_image_suggestion.py b/product_image_suggestion/wizard/product_image_suggestion.py new file mode 100644 index 000000000..d0462a720 --- /dev/null +++ b/product_image_suggestion/wizard/product_image_suggestion.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: RAHUL CK (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 . +# +############################################################################### +from odoo import fields, models + + +class ProductImageSuggestion(models.TransientModel): + """Creates new model to store the searched image""" + _name = "product.image.suggestion" + _description = "Attach images and set image as the display image of product" + + image = fields.Binary(string='Image', attachment=True, + help="Image field to store the image") + product_tmpl_id = fields.Many2one('product.template', + string='Related Product', + help="""Product field to store the id + of product from which the image is + searched""") + + def action_set_image(self): + """Set product images from suggested images""" + self.product_tmpl_id.image_1920 = self.image