Browse Source

[ADD] Initial Commit 'product_import'

pull/164/head
Ajmal Cybro 5 years ago
parent
commit
618dea93bc
  1. 36
      product_import/README.rst
  2. 23
      product_import/__init__.py
  3. 44
      product_import/__manifest__.py
  4. BIN
      product_import/demo/phone.jpeg
  5. 4
      product_import/demo/product.csv
  6. BIN
      product_import/demo/product.xlsx
  7. BIN
      product_import/demo/watch.jpg
  8. 22
      product_import/models/__init__.py
  9. 52
      product_import/models/product_url.py
  10. 2
      product_import/security/ir.model.access.csv
  11. BIN
      product_import/static/description/banner.png
  12. BIN
      product_import/static/description/icon.png
  13. BIN
      product_import/static/description/images/banner.png
  14. BIN
      product_import/static/description/images/barcode.jpeg
  15. BIN
      product_import/static/description/images/checked.png
  16. BIN
      product_import/static/description/images/credit_exceed.png
  17. BIN
      product_import/static/description/images/customer_credit.png
  18. BIN
      product_import/static/description/images/cybrosys.png
  19. BIN
      product_import/static/description/images/multiple_products.png
  20. BIN
      product_import/static/description/images/product.gif
  21. BIN
      product_import/static/description/images/product_import.png
  22. BIN
      product_import/static/description/images/product_import1.png
  23. BIN
      product_import/static/description/images/product_import_2.png
  24. BIN
      product_import/static/description/images/product_import_3.png
  25. BIN
      product_import/static/description/images/product_import_4.png
  26. BIN
      product_import/static/description/images/product_import_5.png
  27. BIN
      product_import/static/description/images/product_import_6.png
  28. BIN
      product_import/static/description/images/product_import_7.png
  29. BIN
      product_import/static/description/images/product_recom.png
  30. BIN
      product_import/static/description/images/product_to_quota.png
  31. 536
      product_import/static/description/index.html
  32. 29
      product_import/views/product_url.xml
  33. 22
      product_import/wizard/__init__.py
  34. 146
      product_import/wizard/product_import.py
  35. 36
      product_import/wizard/product_import.xml

36
product_import/README.rst

@ -0,0 +1,36 @@
Product Image from URL
======================
Product Image from URL and Path
Configuration
=============
* No additional configurations needed
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
* Developers: Mohammed Shahil MP @cybrosys, odoo@cybrosys.com
Minhaj T @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 <https://cybrosys.com/>`__
Further information
===================
HTML Description: `<static/description/index.html>`__

23
product_import/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import wizard
from . import models

44
product_import/__manifest__.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
{
'name': 'Product Image from URL',
'summary': 'Product Images from Web URL and Path',
'version': '14.0.1.0.0',
'description': """Product Images from Web URL, Product Images from path, local""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'category': 'Sales',
'license': 'AGPL-3',
'images': ['static/description/banner.png'],
'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,
}

BIN
product_import/demo/phone.jpeg

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

4
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,
1 Product name product type Barcode Price Image
2 Laptop consu 5465465554 25000 https://images-na.ssl-images-amazon.com/images/I/81xe3aoU6BL._AC_SL1500_.jpg
3 watch product 7981234174 3500 /home/cybrosys/Desktop/watch.jpg
4 bike service 8720132165 2700

BIN
product_import/demo/product.xlsx

Binary file not shown.

BIN
product_import/demo/watch.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 KiB

22
product_import/models/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import product_url

52
product_import/models/product_url.py

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
import requests
import base64
from odoo import models, fields, api
class ProductImage(models.Model):
_inherit = 'product.template'
image_url = fields.Char(string='Image URL')
@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')
@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

2
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_product_import_product_import product_import.product_import model_product_import base.group_user 1 1 1 1

BIN
product_import/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
product_import/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
product_import/static/description/images/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

BIN
product_import/static/description/images/barcode.jpeg

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

BIN
product_import/static/description/images/checked.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
product_import/static/description/images/credit_exceed.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
product_import/static/description/images/customer_credit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

BIN
product_import/static/description/images/cybrosys.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
product_import/static/description/images/multiple_products.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

BIN
product_import/static/description/images/product.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
product_import/static/description/images/product_import.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
product_import/static/description/images/product_import1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
product_import/static/description/images/product_import_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
product_import/static/description/images/product_import_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
product_import/static/description/images/product_import_4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
product_import/static/description/images/product_import_5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
product_import/static/description/images/product_import_6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
product_import/static/description/images/product_import_7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
product_import/static/description/images/product_recom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
product_import/static/description/images/product_to_quota.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

536
product_import/static/description/index.html

@ -0,0 +1,536 @@
<div class="row"
style="margin: 0;position: relative;color: #000;background-position: center;background: #ffffff;border-bottom: 1px solid #e4e4e4;text-align: center; margin: auto; display: flex;justify-content: center;">
<a href="https://www.cybrosys.com/" target="_blank"><img src="images/cybrosys.png"
style=" width: 293px; padding: 1rem 0rem; margin: auto"
alt="cybrosys-logo"></a></div>
<div class="row"
style="margin:75px 0;position: relative;color: #000;background-position: center;background: #ffffff;border-bottom: 1px solid #e4e4e4; padding-bottom: 30px;">
<div class="col-md-7 col-sm-12 col-xs-12" style="padding: 0px">
<div style=" margin: 0 0 0px;padding: 20px 0 10;font-size: 23px;line-height: 35px;font-weight: 400;color: #000;border-top: 1px solid rgba(255,255,255,0.1);border-bottom: 1px solid rgba(255,255,255,0.11);text-align: left;">
<h1 style="font-size: 39px;font-weight: 600;margin: 0px !important;">Product Image from URL</h1>
<h3 style="font-size: 21px;margin-top: 8px;position: relative;"> Product Image from URL and Path</h3>
</div>
<h2 style="font-weight: 600;font-size: 1.8rem;margin-top: 15px;">Key Highlights</h2>
<ul style=" padding: 0 1px; list-style: none; ">
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 18px;"><img
src="images/checked.png" style=" width: 22px; margin-right: 6px; " alt="check">Import product images from path and URL.
</li>
<li style="display: flex;align-items: center;padding: 8px 0;font-size: 18px;"><img
src="images/checked.png" style=" width: 22px; margin-right: 6px; " alt="check">Load image in product from url field.
</li>
</ul>
</div>
<div class="col-md-5 col-sm-12 col-xs-12"><img src="images/product_import1.png"
class="img-responsive" alt=""></div>
</div>
<div>
<section class="oe_container"
style="padding: 1rem 0rem 1rem; background-color: #ffffff !important;">
<div class="row py-4 px-3">
<div class="w-100" style="padding-top:30px;padding-bottom:45px;border-radius: 10px;">
<ul role="tablist" class="nav nav-pills justify-content-center" data-tabs="tabs"
id="pills-tab" style="border: none;background: unset;">
<li class="nav-item mr-1 mb-3"
style="font-size: 1.05rem;font-weight: 400;transition: all .15s ease;color: #d31c22;background-color: #d31c22;box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);border: 0;font-family: 'Open Sans',sans-serif;width: 140px;border-radius: 0.30rem;">
<a id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab"
aria-controls="pills-home" aria-selected="true"
class="nav-link active show" style="color: #000000;line-height: 33px;border: 0;border-radius: .25rem;font-weight: 400;text-align: center;
color: #fff;">Overview </a></li>
<li class="nav-item mr-1 mb-3"
style="font-size: 1.05rem;font-weight: 400;transition: all .15s ease;color: #d31c22;background-color: #d31c22;box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);border: 0;font-family: 'Open Sans',sans-serif;width: 140px;border-radius: 0.30rem;">
<a id="pills-home-tab" data-toggle="pill" href="#pills-home1" role="tab"
aria-controls="pills-home" aria-selected="true" class="nav-link " style="color: #000000;line-height: 33px;border: 0;border-radius: .25rem;font-weight: 400; text-align: center;
color: #fff;">Features </a></li>
<li class="nav-item mr-1 mb-3"
style="font-size: 1.05rem;font-weight: 400;transition: all .15s ease;color: #ffffff;background-color: #d31c22;box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);border: 0;font-family: 'Open Sans',sans-serif;width: 140px;border-radius: 0.30rem;">
<a class="nav-link" id="pills-profile-tab" data-toggle="pill"
href="#pills-profile" role="tab" aria-controls="pills-profile"
aria-selected="false" style="color: #000000;line-height: 33px;border: 0;border-radius: .25rem;font-weight: 400; text-align: center;
color: #fff;">Screenshots </a></li>
<!-- <li class="nav-item mr-1 mb-3" style="font-size: 1.05rem;font-weight: 400;transition: all .15s ease;color: #ffffff;background-color: #d31c22;box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);border: 0;font-family: 'Open Sans',sans-serif;width: 140px;border-radius: 0.30rem;"> <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-video" role="tab" aria-controls="pills-profile" aria-selected="false" style="color: #000000;line-height: 33px;border: 0;border-radius: .25rem;font-weight: 400; text-align: center;-->
<!-- color: #fff;">Video </a> </li>-->
</ul>
<div class="tab-content" id="pills-tabContent"
style="padding-top: 30px; padding-bottom: 30px; padding: 30px;">
<div class="px-3 pt-1 tab-pane fade active show" id="pills-home" role="tabpanel"
aria-labelledby="
pills-home-tab">
<!-- Overview-->
<h2 style="font-weight: 600;text-align: center;width: 100%;">Overview</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">
<h3 class="oe_slogan"
style="text-align: center;font-size: 19px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 31px;font-weight: 400;letter-spacing: .5px;margin-bottom: 21px;">
With the help of this App you can easily load product image from URL and Path, You can also load images by pasting url in the field.
</h3>
</div>
<div class="px-3 pt-1 tab-pane fade " id="pills-home1" role="tabpanel"
aria-labelledby="
pills-home-tab">
<!-- feature tab-->
<h2 style="font-weight: 600;text-align: center;width: 100%;">Product Image from URL</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">
<ul>
<li class="mb8"
style="font-family: Roboto;color: #000;list-style-type: square;font-size: 19px;line-height: 50px; background-color: #3a34380d;padding-left: 20px;border-radius: 7px;list-style: none;">
<img src="images/checked.png"
style=" width: 22px; margin-right: 6px; " alt="check">Import Product image from path and URL.
</li>
<li class="mb8"
style="font-family: Roboto;color: #000;list-style-type: square;font-size: 19px;line-height: 50px; background-color: #3a34380d;padding-left: 20px;border-radius: 7px;list-style: none;">
<img src="images/checked.png"
style=" width: 22px; margin-right: 6px; " alt="check">Load image in product using URL in product view itself.
</li>
</ul>
</div>
<!-- Screenshot tab-->
<div class="px-3 tab-pane fade" id="pills-profile" role="tabpanel"
aria-labelledby="pills-profile-tab">
<div class="tab-pane">
<h2 style="font-weight: 600;text-align: center;width: 100%;">
Screenshots</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">
<div>
<section class="oe_container">
<div id="demo" class="row carousel slide mb32"
data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" style="min-height: 0px;">
<div class="col-xs-12 col-sm-12 col-md-12 mb16 mt16"
style="float: left;">
<h3 class="alert"
style="font-weight:400;color: #091E42;background: #fff;text-align: left;border-radius: 0; font-size: 18px;">
<img src="images/checked.png"
style=" width: 22px; margin-right: 6px; "
alt="check"> We can add the product image by updating URL in the given field.</h3>
<div style=""><img
class="img img-responsive center-block"
style="border-top-left-radius: 10px;border-top-right-radius: 10px;"
src="images/product_import_7.png"></div>
</div>
</div>
<a class="carousel-control-prev" href="#demo"
data-slide="prev"
style="left:-25px;width: 35px;color: #000;"> <span
class="carousel-control-prev-icon"><i
class="fa fa-chevron-left"
style="font-size:24px"></i></span> </a> <a
class="carousel-control-next" href="#demo"
data-slide="next"
style="right:-25px;width: 35px;color: #000;"> <span
class="carousel-control-next-icon"><i
class="fa fa-chevron-right"
style="font-size:24px"></i></span> </a>
</div>
<a class="carousel-control-prev" href="#demo"
data-slide="prev"
style="left:-25px;width: 35px;color: #000;"> <span
class="carousel-control-prev-icon"><i
class="fa fa-chevron-left"
style="font-size:24px"></i></span> </a> <a
class="carousel-control-next" href="#demo"
data-slide="next"
style="right:-25px;width: 35px;color: #000;"> <span
class="carousel-control-next-icon"><i
class="fa fa-chevron-right" style="font-size:24px"></i></span>
</a>
</div>
</section>
</div>
</div>
</div>
<!-- <div class="px-3 pt-1 tab-pane fade" id="pills-video" role="tabpanel" aria-labelledby="-->
<!-- pills-home-tab">-->
<!-- &lt;!&ndash; Video&ndash;&gt;-->
<!-- <h2 style="font-weight: 600;text-align: center;width: 100%;">Video</h2>-->
<!-- <hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">-->
<!-- <center>-->
<!-- <p>POS Booking Order Demo</p>-->
<!-- &lt;!&ndash;<a href="https://www.youtube.com/watch?v=57QWXrMYe84&feature=youtu.be" target="_blank"> <img src="addon-youtube.png" style="width:80%;"></a>&ndash;&gt;-->
<!-- <div class="s_panel_video" data-video-id="7PFB7FpMFyM?rel=0" style="cursor:pointer;">-->
<!-- <img class="img-fluid s_tooltip_tabs_tooltip_image s_figure_link pb0" src="images/task_timer_youtube.png" alt="Cybrosys Cover Video" style="max-width:100%;">-->
<!-- </div>-->
<!-- </center>-->
<!-- </div>-->
<!-- faq tab-->
<div class="px-2 px-lg-4 pt-3 tab-pane fade" id="pills-contact" role="tabpanel"
aria-labelledby="pills-contact-tab">
<ul class="list-unstyled">
</ul>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="padding: 2rem 3rem 1rem;">
<h2 style="font-weight: 600;text-align: center;margin-bottom: 25px;width: 100%;">Suggested
Products</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active" style="min-height: 0px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left;">
<a href="https://apps.odoo.com/apps/modules/13.0/sales_credit_limit/"
target="_blank">
<div style="box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);border-radius: 10px;">
<img class="img img-responsive center-block"
style="border-top-left-radius: 10px;border-top-right-radius: 10px;"
src="images/customer_credit.png"></div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left;">
<a href="https://apps.odoo.com/apps/modules/13.0/product_to_quotation_pro/"
target="_blank">
<div style="box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);border-radius: 10px;">
<img class="img img-responsive center-block"
style="border-top-left-radius: 10px;border-top-right-radius: 10px;"
src="images/multiple_products.png"></div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left;">
<a href="https://apps.odoo.com/apps/modules/13.0/product_to_quotation/"
target="_blank">
<div style="box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);border-radius: 10px;">
<img class="img img-responsive center-block"
style="border-top-left-radius: 10px;border-top-right-radius: 10px;"
src="images/product_to_quota.png"></div>
</a>
</div>
</div>
<div class="carousel-item" style="min-height: 0px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left;">
<a href="https://apps.odoo.com/apps/modules/13.0/credit_limit_report_xlsx/"
target="_blank">
<div style="box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);border-radius: 10px;">
<img class="img img-responsive center-block"
style="border-top-left-radius: 10px;border-top-right-radius: 10px;"
src="images/credit_exceed.png"></div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left;">
<a href="https://apps.odoo.com/apps/modules/13.0/product_recommendation_in_sales_order/"
target="_blank">
<div style="box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);border-radius: 10px;">
<img class="img img-responsive center-block"
style="border-top-left-radius: 10px;border-top-right-radius: 10px;"
src="images/product_recom.png"></div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left;">
<a href="https://apps.odoo.com/apps/modules/13.0/barcode_scanning_sale_purchase/"
target="_blank">
<div style="box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);border-radius: 10px;">
<img class="img img-responsive center-block"
style="border-top-left-radius: 10px;border-top-right-radius: 10px;"
src="images/barcode.jpeg"></div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev"
style="left:-25px;width: 35px;color: #000;"> <span
class="carousel-control-prev-icon"><i class="fa fa-chevron-left"
style="font-size:24px"></i></span> </a> <a
class="carousel-control-next" href="#demo1" data-slide="next"
style="right:-25px;width: 35px;color: #000;"> <span
class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span> </a>
</div>
</section>
<section class="row" style="padding: 2rem 3rem 1rem;margin:0px">
<h2 style="font-weight: 600;margin-bottom: 20px;text-align: center;width: 100%;">Our
Service</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">
<div class="row"
style=" display: flex; justify-content: center; flex-wrap: wrap;width: 100%; ">
<!-- <div style="display:flex;padding-top: 20px;justify-content: space-between;"> -->
<div class="col-md-2 col-sm-6 col-xs-12">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-customization-and-installation/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-customization.png"
style="width: 100%;border-radius: 100%;"/> </a></div>
<h3 class="oe_slogan"
style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-customization-and-installation/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Odoo Customization </a></h3>
</div>
<div class="col-md-2 col-sm-6 col-xs-12">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-implementation/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-erp-implementation.png"
style="width: 100%;border-radius: 100%;"/> </a></div>
<h3 class="oe_slogan"
style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-implementation/" target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Odoo Implementation </a></h3>
</div>
<div class="col-md-2 col-sm-6 col-xs-12">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-integration/" target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-erp-integration.png"
style="width: 100%;border-radius: 100%;"/> </a></div>
<h3 class="oe_slogan"
style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-integration/" target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Odoo Integration </a></h3>
</div>
<div class="col-md-2 col-sm-6 col-xs-12">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-support/" target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-erp-support.png"
style="width: 100%;border-radius: 100%;"/> </a></div>
<h3 class="oe_slogan"
style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-support/" target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Odoo Support</a></h3>
</div>
<div class="col-md-2 col-sm-6 col-xs-12">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/hire-odoo-developer/" target="_blank"> <img
src="https://www.cybrosys.com/images/hire-odoo-developer.png"
style="width: 100%;border-radius: 100%;"/> </a></div>
<h3 class="oe_slogan"
style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/hire-odoo-developer/" target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Hire Odoo Developers</a></h3>
</a>
</div>
<!-- </div> -->
</div>
</section>
<section class="row" style="padding: 2rem 3rem 1rem;margin:0px">
<div class="row" style="margin: 0">
<h2 style="font-weight: 600;margin-bottom: 20px;text-align: center;width: 100%;">Our
Industries</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">
<!-- <div style="display:flex;justify-content: space-between;flex-wrap:wrap;"> -->
<div class="row" style="width: 100%">
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/best-trading-erp/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-index-industry-1.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/best-trading-erp/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none;font-family: 'Montserrat',sans-serif;">
Trading </a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px; font-family: 'Montserrat',sans-serif;">
Easily procure and sell your products. </h3>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/manufacturing-erp-software/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-index-industry-2.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;" style=" margin-bottom: 10px; ">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/manufacturing-erp-software/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none;font-family: 'Montserrat',sans-serif;">
Manufacturing</a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;font-family: 'Montserrat',sans-serif;">
Plan, track and schedule your operations. </h3>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/restaurant-management/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-index-industry-3.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/restaurant-management/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none;font-family: 'Montserrat',sans-serif;">
Restaurant</a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;font-family: 'Montserrat',sans-serif;">
Run your bar or restaurant methodical. </h3>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/pos/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-4.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/pos/" target="_blank"
style="list-style: none; color:#000; text-decoration: none;font-family: 'Montserrat',sans-serif;">
POS</a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;font-family: 'Montserrat',sans-serif;">
Easy configuring and convivial selling. </h3>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/ecommerce-website/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-index-industry-5.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 0px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/ecommerce-website/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
E-commerce & Website</a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px; font-family: 'Montserrat',sans-serif;">
Mobile friendly, awe-inspiring product pages. </h3>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/hotel-management-erp/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-index-industry-6.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/hotel-management-erp/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Hotel Management</a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px; font-family: 'Montserrat',sans-serif;">
An all-inclusive hotel management application. </h3>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/education-erp-software/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-index-industry-7.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/education-erp-software/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Education</a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px; font-family: 'Montserrat',sans-serif;">
A Collaborative platform for educational management. </h3>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12" style=" margin-bottom: 10px; ">
<div>
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/service-management/"
target="_blank"> <img
src="https://www.cybrosys.com/images/odoo-index-industry-8.png"
alt="Odoo Industry"
style=" border-radius: 100%;width:100%;"/> </a></div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan"
style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/service-management/"
target="_blank"
style="list-style: none; color:#000; text-decoration: none; font-family: 'Montserrat',sans-serif;">
Service Management</a></h3>
<h3 class="oe_slogan"
style=" text-align: left;font-size: 12px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px; font-family: 'Montserrat',sans-serif;">
Keep track of services and invoice accordingly. </h3>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="padding: 0% 0% 6% 0%;">
<center>
<div class="col-md-12" style="margin: auto !important;
width: 70%;
padding: 30px;">
<h2 style="font-weight: 600;text-align: center;width: 100%;">Need Any Help?</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;">
<h4 style="font-size:16px;"> 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. </h4>
<div class="col-md-6" style="float:left; padding:20px;">
<h4><i class="fa fa-envelope"></i>Email us </h4>
<p>odoo@cybrosys.com / info@cybrosys.com</p>
</div>
<div class="col-md-6" style="float:left; padding:20px;">
<h4><i class="fa fa-phone"></i> Contact Us </h4>
<a href="https://www.cybrosys.com/contact/" target="_blank"> www.cybrosys.com</a>
</div>
</div>
</center>
</section>
<section class="oe_container" style="padding: 0% 0% 6% 0%;">
<div class="oe_slogan" style="margin-bottom: 0px;">
<div style=" display: flex; justify-content: center; flex-wrap: wrap; ">
</div>
<br>
<img src="https://www.cybrosys.com/images/logo.png"
style="width: 190px; margin-bottom: 25px;margin-top: 30px;" class="center-block">
<div style=" display: flex; justify-content: center; flex-wrap: wrap; "><a
href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter"
style="color:white;background: #00a0d1;width:35px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a>
</td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd"
target="_blank"><i class="fa fa-2x fa-linkedin"
style="color:white;background: #31a3d6;width:35px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a>
</td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i
class="fa fa-2x fa-facebook"
style="color:white;background: #3b5998;width:35px; height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a>
</td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i
class="fa fa-2x fa-pinterest"
style="color:white;background: #ac0f18;width:35px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a>
</td>
</div>
</div>
</section>
</div>

29
product_import/views/product_url.xml

@ -0,0 +1,29 @@
<odoo>
<record id="product_url_form" model="ir.ui.view">
<field name="name">Product URL</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="image_url" class="oe_edit_only"/>
</field>
</field>
</record>
<record id="product_variant_url_form" model="ir.ui.view">
<field name="name">Product URL</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="image_url" class="oe_edit_only"/>
</field>
</field>
</record>
</odoo>

22
product_import/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import product_import

146
product_import/wizard/product_import.py

@ -0,0 +1,146 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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)

36
product_import/wizard/product_import.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_import_view" model="ir.ui.view">
<field name="name">Import Product</field>
<field name="model">product.import</field>
<field name="arch" type="xml">
<form string="Product Options">
<group col="4">
<field name="file"/>
<field name="option" widget="radio"/>
</group>
<footer>
<button name="import_file" string="Import" type="object" default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="product_import_action" model="ir.actions.act_window">
<field name="name">Import Product</field>
<field name="res_model">product.import</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="product_import_view"/>
<field name="context">{}</field>
<field name="target">new</field>
</record>
<menuitem id="menu_product_import"
name="Import Product"
action="product_import_action"
parent="sale.product_menu_catalog"/>
</odoo>
Loading…
Cancel
Save