diff --git a/product_import/README.rst b/product_import/README.rst new file mode 100644 index 000000000..b594f651d --- /dev/null +++ b/product_import/README.rst @@ -0,0 +1,35 @@ +Import Product From Excel +========================= +Using the application, the user can easily load product image from URL in the product, import product image, barcode, name, type, and price from XLS/CSV file. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: Mohammed Shahil MP @cybrosys, 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 `Our Website `__ + +Further information +=================== +HTML Description: ``__ + + diff --git a/product_import/__init__.py b/product_import/__init__.py new file mode 100644 index 000000000..a65bb6e3b --- /dev/null +++ b/product_import/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Mohammed Shahil MP @cybrosys(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..c046ebe8f --- /dev/null +++ b/product_import/__manifest__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Mohammed Shahil MP @cybrosys(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': 'Import Product From Excel', + 'summary': 'Import Product From Excel or CSV File, Import Product Image From URL and Path', + 'version': '13.0.1.0.0', + 'description': """Import product from excel,XLSX,CSV,Import product image from Excel,Import product from URL, + Import product from path,import product details usinf xlsx,import product,odoo13 sales,odoo13, + odoo13 xlsx,odoo13,mport product barcode from csv,Import product price from csv,Import product type from csv, + create product from csv,Import product from csv""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'category': 'Sales', + 'license': 'AGPL-3', + 'depends': ['sale_management', 'stock'], + 'data': [ + 'security/ir.model.access.csv', + 'views/product_url.xml', + 'wizard/product_import.xml', + ], + 'installable': True, + 'application': False, + 'auto_install': 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..7cc59fcda --- /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 +watch,product,7981234174,3500,/home/cybrosys/Desktop/watch.jpg +bike,service,8720132165,2700, diff --git a/product_import/demo/product.xlsx b/product_import/demo/product.xlsx new file mode 100644 index 000000000..352b28f3b 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/models/__init__.py b/product_import/models/__init__.py new file mode 100644 index 000000000..dea9a8296 --- /dev/null +++ b/product_import/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Mohammed Shahil MP @cybrosys(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_url diff --git a/product_import/models/product_url.py b/product_import/models/product_url.py new file mode 100644 index 000000000..5081cacd2 --- /dev/null +++ b/product_import/models/product_url.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Mohammed Shahil MP @cybrosys(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 models, fields, api + + +class ProductImage(models.Model): + _inherit = 'product.template' + + image_url = fields.Char(string='Image URL') + image = fields.Binary(string='Image') + + @api.onchange('image_url') + def _onchange_image_url(self): + """ function to load image from URL """ + image = False + if self.image_url: + image = base64.b64encode(requests.get(self.image_url).content) + self.image_1920 = image + + +class ProductVariantImage(models.Model): + _inherit = 'product.product' + + image_url = fields.Char(string='Image URL') + image = fields.Binary(string='Image') + + @api.onchange('image_url') + def _onchange_image_url(self): + """ function to load image from URL in product variant""" + image = False + if self.image_url: + image = base64.b64encode(requests.get(self.image_url).content) + self.image_1920 = image \ No newline at end of file diff --git a/product_import/security/ir.model.access.csv b/product_import/security/ir.model.access.csv new file mode 100644 index 000000000..bbfb68a12 --- /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 \ No newline at end of file diff --git a/product_import/static/description/Icon.png b/product_import/static/description/Icon.png new file mode 100644 index 000000000..6a9a61cbf Binary files /dev/null and b/product_import/static/description/Icon.png differ diff --git a/product_import/static/description/banner.png b/product_import/static/description/banner.png new file mode 100644 index 000000000..6c0242821 Binary files /dev/null and b/product_import/static/description/banner.png differ diff --git a/product_import/static/description/images/banner.png b/product_import/static/description/images/banner.png new file mode 100644 index 000000000..6c0242821 Binary files /dev/null and b/product_import/static/description/images/banner.png differ diff --git a/product_import/static/description/images/barcode.jpeg b/product_import/static/description/images/barcode.jpeg new file mode 100644 index 000000000..529143e4e Binary files /dev/null and b/product_import/static/description/images/barcode.jpeg differ diff --git a/product_import/static/description/images/checked.png b/product_import/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/product_import/static/description/images/checked.png differ diff --git a/product_import/static/description/images/credit_exceed.png b/product_import/static/description/images/credit_exceed.png new file mode 100644 index 000000000..e35c8df65 Binary files /dev/null and b/product_import/static/description/images/credit_exceed.png differ diff --git a/product_import/static/description/images/customer_credit.png b/product_import/static/description/images/customer_credit.png new file mode 100644 index 000000000..036c91d9a Binary files /dev/null and b/product_import/static/description/images/customer_credit.png differ diff --git a/product_import/static/description/images/cybrosys.png b/product_import/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/product_import/static/description/images/cybrosys.png differ diff --git a/product_import/static/description/images/multiple_products.png b/product_import/static/description/images/multiple_products.png new file mode 100644 index 000000000..3a2051a87 Binary files /dev/null and b/product_import/static/description/images/multiple_products.png differ diff --git a/product_import/static/description/images/product.gif b/product_import/static/description/images/product.gif new file mode 100644 index 000000000..fbc49eda3 Binary files /dev/null and b/product_import/static/description/images/product.gif differ diff --git a/product_import/static/description/images/product_import.png b/product_import/static/description/images/product_import.png new file mode 100644 index 000000000..68e8595eb Binary files /dev/null and b/product_import/static/description/images/product_import.png differ diff --git a/product_import/static/description/images/product_import_2.png b/product_import/static/description/images/product_import_2.png new file mode 100644 index 000000000..f0b29141f Binary files /dev/null and b/product_import/static/description/images/product_import_2.png differ diff --git a/product_import/static/description/images/product_import_3.png b/product_import/static/description/images/product_import_3.png new file mode 100644 index 000000000..8984d3e49 Binary files /dev/null and b/product_import/static/description/images/product_import_3.png differ diff --git a/product_import/static/description/images/product_import_4.png b/product_import/static/description/images/product_import_4.png new file mode 100644 index 000000000..8dfdc58af Binary files /dev/null and b/product_import/static/description/images/product_import_4.png differ diff --git a/product_import/static/description/images/product_import_5.png b/product_import/static/description/images/product_import_5.png new file mode 100644 index 000000000..3f24cc1f4 Binary files /dev/null and b/product_import/static/description/images/product_import_5.png differ diff --git a/product_import/static/description/images/product_import_6.png b/product_import/static/description/images/product_import_6.png new file mode 100644 index 000000000..a108ff404 Binary files /dev/null and b/product_import/static/description/images/product_import_6.png differ diff --git a/product_import/static/description/images/product_import_7.png b/product_import/static/description/images/product_import_7.png new file mode 100644 index 000000000..112827960 Binary files /dev/null and b/product_import/static/description/images/product_import_7.png differ diff --git a/product_import/static/description/images/product_recom.png b/product_import/static/description/images/product_recom.png new file mode 100644 index 000000000..6b124fb63 Binary files /dev/null and b/product_import/static/description/images/product_recom.png differ diff --git a/product_import/static/description/images/product_to_quota.png b/product_import/static/description/images/product_to_quota.png new file mode 100644 index 000000000..322f18f64 Binary files /dev/null and b/product_import/static/description/images/product_to_quota.png differ diff --git a/product_import/static/description/index.html b/product_import/static/description/index.html new file mode 100644 index 000000000..77d421eb6 --- /dev/null +++ b/product_import/static/description/index.html @@ -0,0 +1,624 @@ +
+ cybrosys-logo
+
+
+
+

Import Product From Excel

+

Create Product Using Excel/CSV

+
+

Key Highlights

+
    +
  • checkImport product images from path and URL. +
  • +
  • checkImport product barcode. +
  • +
  • checkLoad image in product using URL. +
  • +
+
+
+
+
+
+
+
+ +
+
+ +

Overview

+
+

+ With the help of this App you can easily load product image from URL in the product, import product image, barcode, name, type, and price from XLS/CSV file. You can prepare files with all the above mentioned details, if the product name is already exists then the product will not be created, It is mandatory to use given XLS format to import product +

+
+
+ +

Import Product From Excel

+
+
    +
  • + checkImport Product image from path and URL. +
  • +
  • + checkImport product Barcode, name, type, price from XLS/CSV file. +
  • +
  • + checkProduct with same name will not be created. +
  • +
  • + checkLoad image in product using URL in product view itself. +
  • +
+
+ +
+
+

+ Screenshots

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

Suggested + Products

+
+ +
+
+

Our + Service

+
+ +
+
+
+

Our + Industries

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

+ + Trading

+

+ Easily procure and sell your products.

+
+
+
+
+
+ Odoo Industry
+
+
+

+ + Manufacturing

+

+ Plan, track and schedule your operations.

+
+
+
+
+
+ Odoo Industry
+
+
+

+ + Restaurant

+

+ Run your bar or restaurant methodical.

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

+ + POS

+

+ Easy configuring and convivial selling.

+
+
+
+
+
+ Odoo Industry
+
+
+

+ + E-commerce & Website

+

+ Mobile friendly, awe-inspiring product pages.

+
+
+
+
+
+ Odoo Industry
+
+
+

+ + Hotel Management

+

+ An all-inclusive hotel management application.

+
+
+
+
+
+ Odoo Industry
+
+
+

+ + Education

+

+ A Collaborative platform for educational management.

+
+
+
+
+
+ Odoo Industry
+
+
+

+ + Service Management

+

+ Keep track of services and invoice accordingly.

+
+
+
+
+
+ +
+
+
+

Need Any Help?

+
+

If you have anything to share with us based on your use of + this module, please let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com / info@cybrosys.com

+
+
+

Contact Us

+ www.cybrosys.com +
+
+
+
+
+
+
+
+
+ +
+ + + + + + + +
+
+
+ \ No newline at end of file diff --git a/product_import/views/product_url.xml b/product_import/views/product_url.xml new file mode 100644 index 000000000..eab94f692 --- /dev/null +++ b/product_import/views/product_url.xml @@ -0,0 +1,29 @@ + + + + Product URL + product.template + + + + + + + + + + + + Product URL + product.product + + + + + + + + + + + \ No newline at end of file diff --git a/product_import/wizard/__init__.py b/product_import/wizard/__init__.py new file mode 100644 index 000000000..157975fbb --- /dev/null +++ b/product_import/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Mohammed Shahil MP @cybrosys(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..075156eec --- /dev/null +++ b/product_import/wizard/product_import.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Mohammed Shahil MP @cybrosys(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 Warning +from odoo import models, fields, _ + + +class ProductImport(models.Model): + + _name = 'product.import' + + file = fields.Binary(string="Upload File") + file_name = fields.Char(string="File Name") + option = fields.Selection([ + ('csv', 'CSV'), + ('xlsx', 'XLSX')], default='csv') + + def import_file(self): + """ function to import product details from csv and 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 Warning(_("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], + 'type': file_item.split(",")[1], + 'barcode': file_item.split(",")[2], + 'list_price': file_item.split(",")[3], + 'image_1920': image_thumbnail, + } + product_line = 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], + 'type': file_item.split(",")[1], + 'barcode': file_item.split(",")[2], + 'list_price': file_item.split(",")[3], + 'image_1920': data, + } + product_line = product_temp_data.create(product_name) + else: + product_name = { + 'name': file_item.split(",")[0], + 'type': file_item.split(",")[1], + 'barcode': file_item.split(",")[2], + 'list_price': file_item.split(",")[3], + } + product_line = product_temp_data.create(product_name) + + 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 Warning(_("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], + 'type': line[1], + 'barcode': line[2], + 'list_price': line[3], + 'image_1920': image_thumbnail, + } + product_line = 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], + 'type': line[1], + 'barcode': line[2], + 'list_price': line[3], + 'image_1920': data, + } + product_line = product_temp_data.create(product_name) + else: + product_name = { + 'name': line[0], + 'type': line[1], + 'barcode': line[2], + 'list_price': line[3], + } + product_line = product_temp_data.create(product_name) diff --git a/product_import/wizard/product_import.xml b/product_import/wizard/product_import.xml new file mode 100644 index 000000000..b53c29a0f --- /dev/null +++ b/product_import/wizard/product_import.xml @@ -0,0 +1,36 @@ + + + + + Import Product + product.import + +
+ + + + +
+
+
+
+
+ + + Import Product + product.import + ir.actions.act_window + tree,form + + {} + new + + + + +