diff --git a/product_image_suggestion/README.rst b/product_image_suggestion/README.rst new file mode 100644 index 000000000..ef538be35 --- /dev/null +++ b/product_image_suggestion/README.rst @@ -0,0 +1,63 @@ +.. 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/16.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. + + +Features +======== + +* A seamless and accurate search of product images from Bing. +* Prioritizing the image suggestions via setting the desired search limit. +* Easy image editing; Can automatically resize the image to 1024x1204 px + + +License +======= +GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl.html) + +Credits +======= +* Developer: RAHUL C K @ Cybrosys + +Contacts +-------- +* Mail Contact : odoo@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..2d632e190 --- /dev/null +++ b/product_image_suggestion/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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..ddacae1d7 --- /dev/null +++ b/product_image_suggestion/__manifest__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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': '16.0.1.0.0', + 'category': 'Productivity', + 'summary': 'Suggest product images from google 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', + ], + 'images': ['static/description/banner.jpg'], + 'external_dependencies': {'python': ['Pillow', 'python-resize-image']}, + '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..181ef7717 --- /dev/null +++ b/product_image_suggestion/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 15.07.2023 +#### Version 16.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..044e24382 --- /dev/null +++ b/product_image_suggestion/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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..27d6a16f1 --- /dev/null +++ b/product_image_suggestion/models/bing.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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.request +import urllib + + +class Bing: + """Download images from 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 isinstance(limit, int), "limit must be integer" + self.limit = limit + assert isinstance(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): + """Get the filter from bing""" + if shorthand in ["line", "linedrawing"]: + return "+filterui:photo-linedrawing" + elif shorthand == "photo": + return "+filterui:photo-photo" + elif shorthand == "clipart": + return "+filterui:photo-clipart" + elif shorthand in ["gif", "animatedgif"]: + return "+filterui:photo-animatedgif" + elif shorthand == "transparent": + return "+filterui:photo-transparent" + else: + return "" + + def save_image(self, link, file_path): + """Save image to directory""" + 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 path_string: + path_string.write(image) + + def download_image(self, link): + """Download the images using the url obtained""" + self.download_count += 1 + # Get the image link + 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: + self.download_count -= 1 + self.seen.remove(link) + + def run(self): + """run the download function""" + 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..457d8e7d7 --- /dev/null +++ b/product_image_suggestion/models/downloader.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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): + """download the images within the limit provided""" + 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: + 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..718cbf335 --- /dev/null +++ b/product_image_suggestion/models/product_template.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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 . import downloader +from odoo import api, fields, models, _ +from odoo.exceptions import UserError + +_logger = logging.getLogger(__name__) + + +class ProductTemplate(models.Model): + """ + Check if the searched image limit is greater than 10 and a warning + message will be raised. + """ + _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..!!! Try to' + 'reset the Limit') + + 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(",", + "_") + image_datas = downloader.download(query_string, + limit=rec.image_limit, + output_dir='dataset', + adult_filter_off=False, + timeout=60, verbose=True) + except AttributeError: + 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 self.resize_image: + temp_file, temp_name = tempfile.mkstemp(suffix= + '.png') + file = open(temp_name, "wb") + file.write(img_request) + file.close() + img_data = Image.open(temp_name) + img_data = resizeimage.resize_contain(img_data, + [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: + byte_image = bytearray(img_request) + binary_image = base64.b64encode(byte_image) + vals = { + 'image': binary_image, + 'product_tmpl_id': rec.id + } + self.env['product.image.suggestion'].create(vals) + 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..07b4c4f49 --- /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_product_image_suggestion,access.product.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/chevron.png b/product_image_suggestion/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/product_image_suggestion/static/description/assets/icons/chevron.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/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/misc/categories.png b/product_image_suggestion/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/categories.png differ diff --git a/product_image_suggestion/static/description/assets/misc/check-box.png b/product_image_suggestion/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/check-box.png differ diff --git a/product_image_suggestion/static/description/assets/misc/compass.png b/product_image_suggestion/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/compass.png differ diff --git a/product_image_suggestion/static/description/assets/misc/corporate.png b/product_image_suggestion/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/corporate.png differ diff --git a/product_image_suggestion/static/description/assets/misc/customer-support.png b/product_image_suggestion/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/customer-support.png differ diff --git a/product_image_suggestion/static/description/assets/misc/cybrosys-logo.png b/product_image_suggestion/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/cybrosys-logo.png differ diff --git a/product_image_suggestion/static/description/assets/misc/features.png b/product_image_suggestion/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/features.png differ diff --git a/product_image_suggestion/static/description/assets/misc/logo.png b/product_image_suggestion/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/logo.png differ diff --git a/product_image_suggestion/static/description/assets/misc/pictures.png b/product_image_suggestion/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/pictures.png differ diff --git a/product_image_suggestion/static/description/assets/misc/pie-chart.png b/product_image_suggestion/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/pie-chart.png differ diff --git a/product_image_suggestion/static/description/assets/misc/right-arrow.png b/product_image_suggestion/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/right-arrow.png differ diff --git a/product_image_suggestion/static/description/assets/misc/star.png b/product_image_suggestion/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/star.png differ diff --git a/product_image_suggestion/static/description/assets/misc/support.png b/product_image_suggestion/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/support.png differ diff --git a/product_image_suggestion/static/description/assets/misc/whatsapp.png b/product_image_suggestion/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/product_image_suggestion/static/description/assets/misc/whatsapp.png differ diff --git a/product_image_suggestion/static/description/assets/modules/1.png b/product_image_suggestion/static/description/assets/modules/1.png new file mode 100644 index 000000000..2c8fbb83f Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/1.png differ diff --git a/product_image_suggestion/static/description/assets/modules/2.png b/product_image_suggestion/static/description/assets/modules/2.png new file mode 100644 index 000000000..17ba4d75f Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/2.png differ diff --git a/product_image_suggestion/static/description/assets/modules/3.png b/product_image_suggestion/static/description/assets/modules/3.png new file mode 100644 index 000000000..a29119785 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/3.png differ diff --git a/product_image_suggestion/static/description/assets/modules/4.png b/product_image_suggestion/static/description/assets/modules/4.png new file mode 100644 index 000000000..3add135c3 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/4.png differ diff --git a/product_image_suggestion/static/description/assets/modules/5.png b/product_image_suggestion/static/description/assets/modules/5.png new file mode 100644 index 000000000..31ed46762 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/5.png differ diff --git a/product_image_suggestion/static/description/assets/modules/6.gif b/product_image_suggestion/static/description/assets/modules/6.gif new file mode 100644 index 000000000..0b7368dc0 Binary files /dev/null and b/product_image_suggestion/static/description/assets/modules/6.gif 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..8c6d458cd 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..d2ab35484 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..4695d1071 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..66a683e5f 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.jpg b/product_image_suggestion/static/description/banner.jpg new file mode 100644 index 000000000..da4a6d9e6 Binary files /dev/null and b/product_image_suggestion/static/description/banner.jpg 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..2ea822610 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..337a87e90 --- /dev/null +++ b/product_image_suggestion/static/description/index.html @@ -0,0 +1,559 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ + + +

Product Image Suggestion

+

An effective and user-friendly method of suggesting product images via web downloads

+ + + +
+ + +
+
+ +
+

Explore This + Module

+
+ + + + +
+
+ +
+

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 and Enterprise Support +
+
+ + A seamless and accurate search of product images from Bing +
+
+ + Prioritizing the image suggestions via setting the desired search limit +
+
+ + Easy image editing: Can automatically resize the image to 1024x1204 px +
+
+
+ + + +
+
+ +
+

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. +

+

+ +
+ +
+
+

+ >> Click on the "SET IMAGE" button it will set the Product Image. +

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

Related + 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

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

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ 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..9c080f95e --- /dev/null +++ b/product_image_suggestion/views/product_template_views.xml @@ -0,0 +1,65 @@ + + + + + + product.template.inherit.view.form.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..7e3ad566c --- /dev/null +++ b/product_image_suggestion/wizard/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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..0ee2a33ba --- /dev/null +++ b/product_image_suggestion/wizard/product_image_suggestion.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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""" + for rec in self: + self_image = rec.image + if self_image: + rec.product_tmpl_id.image_1920 = self_image + return{ + 'type': 'ir.actions.client', + 'tag': 'reload', + }