diff --git a/product_import/README.rst b/product_import/README.rst new file mode 100644 index 000000000..518985b1f --- /dev/null +++ b/product_import/README.rst @@ -0,0 +1,56 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Product Image from URL +====================== +Product Image from URL and Local Paths. + +Features +======== +* This module enables to add Product Images from Web URLs and Local Paths. + +Configuration +============= +Nothing to configure. + +License +------- +Affero General Public License, v3.0 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: Mohammed Shahil MP, + (V14) Minhaj T, + (V15) Minhaj T, + (V16) Amaya Aravind, + (V17) Aysha Shalin, + + 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 `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/product_import/__init__.py b/product_import/__init__.py new file mode 100644 index 000000000..621095d78 --- /dev/null +++ b/product_import/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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 wizard +from . import models diff --git a/product_import/__manifest__.py b/product_import/__manifest__.py new file mode 100644 index 000000000..052da8bbd --- /dev/null +++ b/product_import/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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 from URL', + 'version': '17.0.1.0.0', + 'category': 'Sales', + 'summary': 'Product Images from Web URLs and Local Paths', + 'description': """This module enables to add Product Images from Web URLs + and Local Paths""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['sale_management', 'stock'], + 'data': [ + 'security/ir.model.access.csv', + 'views/product_template_views.xml', + 'views/product_product_views.xml', + 'wizard/product_import_views.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/product_import/demo/phone.jpeg b/product_import/demo/phone.jpeg new file mode 100644 index 000000000..d2aadaa42 Binary files /dev/null and b/product_import/demo/phone.jpeg differ diff --git a/product_import/demo/product.csv b/product_import/demo/product.csv new file mode 100644 index 000000000..ff4e78c6e --- /dev/null +++ b/product_import/demo/product.csv @@ -0,0 +1,4 @@ +Product name,product type,Barcode,Price,Image +Laptop,consu,5465465554,25000,https://images-na.ssl-images-amazon.com/images/I/81xe3aoU6BL._AC_SL1500_.jpg +smart phone,product,7081234174,35000,/home/cybrosys/Desktop/phone.jpeg +bike,service,8720132165,2700, diff --git a/product_import/demo/product.xlsx b/product_import/demo/product.xlsx new file mode 100644 index 000000000..b9dfb6f13 Binary files /dev/null and b/product_import/demo/product.xlsx differ diff --git a/product_import/demo/watch.jpg b/product_import/demo/watch.jpg new file mode 100644 index 000000000..13651c909 Binary files /dev/null and b/product_import/demo/watch.jpg differ diff --git a/product_import/doc/RELEASE_NOTES.md b/product_import/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..f371ea643 --- /dev/null +++ b/product_import/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 13.01.2024 +#### Version 17.0.1.0.0 +##### ADD +- Initial Commit for Product Image from URL diff --git a/product_import/models/__init__.py b/product_import/models/__init__.py new file mode 100644 index 000000000..752b3e174 --- /dev/null +++ b/product_import/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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_template diff --git a/product_import/models/product_template.py b/product_import/models/product_template.py new file mode 100644 index 000000000..7391f1c89 --- /dev/null +++ b/product_import/models/product_template.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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 requests +import base64 +from odoo import api, fields, models, _ +from odoo.exceptions import UserError + + +class ProductTemplate(models.Model): + """ Inheriting 'product.template' for adding image url """ + _inherit = 'product.template' + + image_url = fields.Char(string='Image URL', help="Url of Image") + image_added = fields.Binary("Image (1920x1920)", + compute='_compute_image_added', store=True, + help="Uploaded Image") + + @api.depends('image_url') + def _compute_image_added(self): + """ Function to load an image from URL or local file path """ + image = False + if self.image_url: + if self.image_url.startswith(('http://', 'https://')): + # Load image from URL + try: + image = base64.b64encode( + requests.get(self.image_url).content) + except Exception as e: + # Handle URL loading errors + raise UserError( + _(f"Error loading image from URL: {str(e)}")) + else: + # Load image from local file path + try: + with open(self.image_url, 'rb') as image_file: + image = base64.b64encode(image_file.read()) + except Exception as e: + # Handle local file loading errors + raise UserError( + _(f"Error loading image from local path: {str(e)}")) + image_added = image + if image_added: + self.image_1920 = image_added + + +class ProductVariantImage(models.Model): + """ Inheriting 'product.product' for adding image url """ + _inherit = 'product.product' + + image_url = fields.Char(string='Image URL', help="Url of Image") + image_added = fields.Binary("Image (1920x1920)", + compute='_compute_image_added', store=True, + help="Uploaded Image") + + @api.depends('image_url') + def _compute_image_added(self): + """ Function to load an image from URL or local file path """ + image = False + if self.image_url: + if self.image_url.startswith(('http://', 'https://')): + # Load image from URL + try: + image = base64.b64encode( + requests.get(self.image_url).content) + except Exception as e: + # Handle URL loading errors + raise UserError( + _(f"Error loading image from URL: {str(e)}")) + else: + # Load image from local file path + try: + with open(self.image_url, 'rb') as image_file: + image = base64.b64encode(image_file.read()) + except Exception as e: + # Handle local file loading errors + raise UserError( + _(f"Error loading image from local path: {str(e)}")) + image_added = image + if image_added: + self.image_1920 = image_added diff --git a/product_import/security/ir.model.access.csv b/product_import/security/ir.model.access.csv new file mode 100644 index 000000000..f804b803f --- /dev/null +++ b/product_import/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_import_product_import,product_import.product_import,model_product_import,base.group_user,1,1,1,1 diff --git a/product_import/static/description/assets/icons/capture (1).png b/product_import/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/product_import/static/description/assets/icons/capture (1).png differ diff --git a/product_import/static/description/assets/icons/check.png b/product_import/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/product_import/static/description/assets/icons/check.png differ diff --git a/product_import/static/description/assets/icons/chevron.png b/product_import/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/product_import/static/description/assets/icons/chevron.png differ diff --git a/product_import/static/description/assets/icons/cogs.png b/product_import/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/product_import/static/description/assets/icons/cogs.png differ diff --git a/product_import/static/description/assets/icons/consultation.png b/product_import/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/product_import/static/description/assets/icons/consultation.png differ diff --git a/product_import/static/description/assets/icons/ecom-black.png b/product_import/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/product_import/static/description/assets/icons/ecom-black.png differ diff --git a/product_import/static/description/assets/icons/education-black.png b/product_import/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/product_import/static/description/assets/icons/education-black.png differ diff --git a/product_import/static/description/assets/icons/hotel-black.png b/product_import/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/product_import/static/description/assets/icons/hotel-black.png differ diff --git a/product_import/static/description/assets/icons/img.png b/product_import/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/product_import/static/description/assets/icons/img.png differ diff --git a/product_import/static/description/assets/icons/license.png b/product_import/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/product_import/static/description/assets/icons/license.png differ diff --git a/product_import/static/description/assets/icons/lifebuoy.png b/product_import/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/product_import/static/description/assets/icons/lifebuoy.png differ diff --git a/product_import/static/description/assets/icons/manufacturing-black.png b/product_import/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/product_import/static/description/assets/icons/manufacturing-black.png differ diff --git a/product_import/static/description/assets/icons/photo-capture.png b/product_import/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/product_import/static/description/assets/icons/photo-capture.png differ diff --git a/product_import/static/description/assets/icons/pos-black.png b/product_import/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/product_import/static/description/assets/icons/pos-black.png differ diff --git a/product_import/static/description/assets/icons/puzzle.png b/product_import/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/product_import/static/description/assets/icons/puzzle.png differ diff --git a/product_import/static/description/assets/icons/restaurant-black.png b/product_import/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/product_import/static/description/assets/icons/restaurant-black.png differ diff --git a/product_import/static/description/assets/icons/service-black.png b/product_import/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/product_import/static/description/assets/icons/service-black.png differ diff --git a/product_import/static/description/assets/icons/trading-black.png b/product_import/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/product_import/static/description/assets/icons/trading-black.png differ diff --git a/product_import/static/description/assets/icons/training.png b/product_import/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/product_import/static/description/assets/icons/training.png differ diff --git a/product_import/static/description/assets/icons/update.png b/product_import/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/product_import/static/description/assets/icons/update.png differ diff --git a/product_import/static/description/assets/icons/user.png b/product_import/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/product_import/static/description/assets/icons/user.png differ diff --git a/product_import/static/description/assets/icons/wrench.png b/product_import/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/product_import/static/description/assets/icons/wrench.png differ diff --git a/product_import/static/description/assets/misc/Cybrosys R.png b/product_import/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/product_import/static/description/assets/misc/Cybrosys R.png differ diff --git a/product_import/static/description/assets/misc/email.svg b/product_import/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/product_import/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_import/static/description/assets/misc/phone.svg b/product_import/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/product_import/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/product_import/static/description/assets/misc/star (1) 2.svg b/product_import/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/product_import/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/product_import/static/description/assets/misc/support (1) 1.svg b/product_import/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/product_import/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/product_import/static/description/assets/misc/support-email.svg b/product_import/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/product_import/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/product_import/static/description/assets/misc/tick-mark.svg b/product_import/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/product_import/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/product_import/static/description/assets/misc/whatsapp 1.svg b/product_import/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/product_import/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/product_import/static/description/assets/misc/whatsapp.svg b/product_import/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/product_import/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_import/static/description/assets/modules/barcode_scanning_sale_purchase.png b/product_import/static/description/assets/modules/barcode_scanning_sale_purchase.png new file mode 100644 index 000000000..63caf416f Binary files /dev/null and b/product_import/static/description/assets/modules/barcode_scanning_sale_purchase.png differ diff --git a/product_import/static/description/assets/modules/dynamic_product_fields.png b/product_import/static/description/assets/modules/dynamic_product_fields.png new file mode 100644 index 000000000..b6b22cf93 Binary files /dev/null and b/product_import/static/description/assets/modules/dynamic_product_fields.png differ diff --git a/product_import/static/description/assets/modules/product_brand_sale.png b/product_import/static/description/assets/modules/product_brand_sale.png new file mode 100644 index 000000000..476a551df Binary files /dev/null and b/product_import/static/description/assets/modules/product_brand_sale.png differ diff --git a/product_import/static/description/assets/modules/sale_product_image.png b/product_import/static/description/assets/modules/sale_product_image.png new file mode 100644 index 000000000..e9224f6f9 Binary files /dev/null and b/product_import/static/description/assets/modules/sale_product_image.png differ diff --git a/product_import/static/description/assets/modules/sale_purchase_previous_product_cost.png b/product_import/static/description/assets/modules/sale_purchase_previous_product_cost.png new file mode 100644 index 000000000..962b4fa10 Binary files /dev/null and b/product_import/static/description/assets/modules/sale_purchase_previous_product_cost.png differ diff --git a/product_import/static/description/assets/modules/sales_person_signature.png b/product_import/static/description/assets/modules/sales_person_signature.png new file mode 100644 index 000000000..1c1e3ba4f Binary files /dev/null and b/product_import/static/description/assets/modules/sales_person_signature.png differ diff --git a/product_import/static/description/assets/screenshots/1.png b/product_import/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..556488394 Binary files /dev/null and b/product_import/static/description/assets/screenshots/1.png differ diff --git a/product_import/static/description/assets/screenshots/2.png b/product_import/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..7aa697f9c Binary files /dev/null and b/product_import/static/description/assets/screenshots/2.png differ diff --git a/product_import/static/description/assets/screenshots/3.png b/product_import/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..47e9fa15e Binary files /dev/null and b/product_import/static/description/assets/screenshots/3.png differ diff --git a/product_import/static/description/assets/screenshots/4.png b/product_import/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..8b6ebe39b Binary files /dev/null and b/product_import/static/description/assets/screenshots/4.png differ diff --git a/product_import/static/description/assets/screenshots/5.png b/product_import/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..28ba7f6ce Binary files /dev/null and b/product_import/static/description/assets/screenshots/5.png differ diff --git a/product_import/static/description/assets/screenshots/6.png b/product_import/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..75477aaef Binary files /dev/null and b/product_import/static/description/assets/screenshots/6.png differ diff --git a/product_import/static/description/assets/screenshots/7.png b/product_import/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..5cd2bae79 Binary files /dev/null and b/product_import/static/description/assets/screenshots/7.png differ diff --git a/product_import/static/description/assets/screenshots/8.png b/product_import/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..2277a64de Binary files /dev/null and b/product_import/static/description/assets/screenshots/8.png differ diff --git a/product_import/static/description/assets/screenshots/hero.gif b/product_import/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..bf54679b8 Binary files /dev/null and b/product_import/static/description/assets/screenshots/hero.gif differ diff --git a/product_import/static/description/banner.png b/product_import/static/description/banner.png new file mode 100644 index 000000000..69d47fc7d Binary files /dev/null and b/product_import/static/description/banner.png differ diff --git a/product_import/static/description/icon.png b/product_import/static/description/icon.png new file mode 100644 index 000000000..3b4b19ed8 Binary files /dev/null and b/product_import/static/description/icon.png differ diff --git a/product_import/static/description/index.html b/product_import/static/description/index.html new file mode 100644 index 000000000..a5e55bd45 --- /dev/null +++ b/product_import/static/description/index.html @@ -0,0 +1,599 @@ + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+
+
+
+
+

+ Product Image from URL

+

+ Product Images from Web URLs and Local Paths. +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Effortlessly Load a Product Image by Simply Pasting a URL or a Local Path in the Designated Field.

+

You can Utilize Image URLs and Paths During the Product Import Process as well. +

+
+
+
+
+
+
+ +
+
+

Import Product from Products and Product Image by Adding URL or Path.

+

Menu Item for Importing Product as XLSX or CSV and Add Image by URL or Local Path. +

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

+ Paste URL of the Image in the Product Form.

+
+
+
+
+
+
+ +
+
+

+ The Image will Update Once the Record is Saved.

+
+
+
+
+
+
+ +
+
+

+ Menu Item for Importing Product.

+
+
+
+
+
+
+ +
+
+

+ Select the File and Type of File for Importing Products.

+
+
+
+
+
+
+ +
+
+

+ You have the Option to Use URL or a Path for Importing Images.

+

+ The Fields in the File must be in this Format for CSV Importing.

+
+
+
+
+
+
+ +
+
+

+ The Product Details Along with the Images will be Imported.

+
+
+
+
+
+
+ +
+
+

+ The Fields in the File must be in this Format for XLSX Importing.

+
+
+
+
+
+
+ +
+
+

+ The Product Details Along with the Images will be Imported.

+
+
+
+
+
+
+
    +
  • + Load an Image in the Product Directly from the Product View Using a URL or Path. +
  • +
  • + Import Products and Product Images by Adding URLs or Paths. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:10th November 2023 +
+

+ Initial Commit for Product Image from URL.

+
+
+
+
+
+
+
+

Related Products

+
+
+ +
+
+

Our Services

+
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire Odoo Developer

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

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 + 99456767686
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/product_import/views/product_product_views.xml b/product_import/views/product_product_views.xml new file mode 100644 index 000000000..246e7d6bd --- /dev/null +++ b/product_import/views/product_product_views.xml @@ -0,0 +1,14 @@ + + + + + product.normal.form.view.inherit.product.import + product.product + + + + + + + + diff --git a/product_import/views/product_template_views.xml b/product_import/views/product_template_views.xml new file mode 100644 index 000000000..45cb92ad8 --- /dev/null +++ b/product_import/views/product_template_views.xml @@ -0,0 +1,14 @@ + + + + + product.template.only.form.view.inherit.product.import + product.template + + + + + + + + diff --git a/product_import/wizard/__init__.py b/product_import/wizard/__init__.py new file mode 100644 index 000000000..e7c8e0b6e --- /dev/null +++ b/product_import/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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_import diff --git a/product_import/wizard/product_import.py b/product_import/wizard/product_import.py new file mode 100644 index 000000000..894f4d749 --- /dev/null +++ b/product_import/wizard/product_import.py @@ -0,0 +1,158 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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 tempfile +import binascii +import base64 +import certifi +import urllib3 +import xlrd +from odoo.exceptions import UserError +from odoo import fields, models, _ + + +class ProductImport(models.Model): + """ Import Product data """ + _name = 'product.import' + _description = 'Product Import' + + file = fields.Binary(string="Upload File", help="Choose the file to upload") + file_name = fields.Char(string="File Name", help="Name of the file") + option = fields.Selection([ + ('csv', 'CSV'), + ('xlsx', 'XLSX')], default='csv', help="Choose the file type") + + def import_file(self): + """ Function to import product details from csv or xlsx file """ + if self.option == 'csv': + try: + product_temp_data = self.env['product.template'].search([]) + file = base64.b64decode(self.file) + file_string = file.decode('utf-8') + file_string = file_string.split('\n') + http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', + ca_certs=certifi.where()) + except: + raise UserError(_("Please choose the correct file!")) + firstline = True + for file_item in file_string: + if firstline: + firstline = False + continue + product_temp = self.env['product.template'].search( + [('name', '=', file_item.split(",")[0])], limit=0) + if not product_temp.id: + if file_item.split(",")[0]: + if ("http://" in file_item.split(",")[4] or "https://" + in file_item.split(",")[4]): + link = file_item.split(",")[4] + image_response = http.request('GET', link) + image_thumbnail = base64.b64encode( + image_response.data) + product_name = { + 'name': file_item.split(",")[0], + 'detailed_type': file_item.split(",")[1], + 'barcode': file_item.split(",")[2], + 'list_price': file_item.split(",")[3], + 'image_1920': image_thumbnail, + } + product_temp_data.create(product_name) + elif '/home' in file_item.split(",")[4]: + with open(file_item.split(",")[4], 'rb') as file: + data = base64.b64encode(file.read()) + product_name = { + 'name': file_item.split(",")[0], + 'detailed_type': file_item.split(",")[1], + 'barcode': file_item.split(",")[2], + 'list_price': file_item.split(",")[3], + 'image_1920': data, + } + product_temp_data.create(product_name) + else: + product_name = { + 'name': file_item.split(",")[0], + 'detailed_type': file_item.split(",")[1], + 'barcode': file_item.split(",")[2], + 'list_price': file_item.split(",")[3], + } + product_temp_data.create(product_name) + else: + raise UserError(_("Add the product which is not available" + "in products")) + if self.option == 'xlsx': + try: + product_temp_data = self.env['product.template'].search([]) + file_string = tempfile.NamedTemporaryFile(suffix=".xlsx") + file_string.write(binascii.a2b_base64(self.file)) + book = xlrd.open_workbook(file_string.name) + sheet = book.sheet_by_index(0) + http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', + ca_certs=certifi.where()) + except: + raise UserError(_("Please choose the correct file")) + startline = True + for i in range(sheet.nrows): + if startline: + startline = False + else: + line = list(sheet.row_values(i)) + product_temp = self.env['product.template'].search( + [('name', '=', line[0])], limit=0) + if not product_temp.id: + if line[0]: + if "http://" in line[4] or "https://" in line[4]: + link = line[4] + image_response = http.request('GET', link) + image_thumbnail = base64.b64encode( + image_response.data) + product_name = { + 'name': line[0], + 'detailed_type': line[1], + 'barcode': line[2], + 'list_price': line[3], + 'image_1920': image_thumbnail, + } + product_temp_data.create( + product_name) + elif "/home" in line[4]: + with open(line[4], 'rb') as file: + data = base64.b64encode(file.read()) + product_name = { + 'name': line[0], + 'detailed_type': line[1], + 'barcode': line[2], + 'list_price': line[3], + 'image_1920': data, + } + product_temp_data.create( + product_name) + else: + product_name = { + 'name': line[0], + 'detailed_type': line[1], + 'barcode': line[2], + 'list_price': line[3], + } + product_temp_data.create( + product_name) + else: + raise UserError(_( + "Add the product which not available in products")) diff --git a/product_import/wizard/product_import_views.xml b/product_import/wizard/product_import_views.xml new file mode 100644 index 000000000..72ec23767 --- /dev/null +++ b/product_import/wizard/product_import_views.xml @@ -0,0 +1,35 @@ + + + + + import.product.view.form + product.import + +
+ + + + +
+
+
+
+
+ + + Import Product + product.import + ir.actions.act_window + tree,form + + {} + new + + + +