Browse Source

[ADD] Initial Commit

pull/57/head
Cybrosys 7 years ago
parent
commit
fe90f55977
  1. 30
      product_image_url/README.rst
  2. 22
      product_image_url/__init__.py
  3. 42
      product_image_url/__manifest__.py
  4. 22
      product_image_url/models/__init__.py
  5. 49
      product_image_url/models/product_inherit.py
  6. BIN
      product_image_url/static/description/banner.jpg
  7. BIN
      product_image_url/static/description/cybro_logo.png
  8. BIN
      product_image_url/static/description/icon.png
  9. BIN
      product_image_url/static/description/image_url.png
  10. 105
      product_image_url/static/description/index.html
  11. BIN
      product_image_url/static/description/product_form.png
  12. BIN
      product_image_url/static/description/warning.png
  13. 13
      product_image_url/views/product_inherit_view.xml

30
product_image_url/README.rst

@ -0,0 +1,30 @@
Product Image From Web v10
==========================
This Cybrosys's module allows you to easily attach product image directly from the internet.
You don't need to bother the product for an image.
Just Google the product's name and identify & select it's photo. Copy the image URL and paste in image URL field in Odoo.
This module will attach the corresponding photo in product form.
Features
========
* Product Images from Internet.
* Just copy the image address & paste it in "Image URL" field.
Technical Notes
===============
Used Libraries:
* PIL
* urllib2
* requests
* urllib2
* base64
Credits
=======
* Cybrosys Techno Solutions<https://www.cybrosys.com>
Author
------
Developer: Nilmar Shereef @ cybrosys, shereef@cybrosys.in

22
product_image_url/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
import models

42
product_image_url/__manifest__.py

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
{
'name': 'Product Image from URL',
'version': '10.0.1.0',
'summary': """Product Images from Web URL""",
'description': """Product Images from Web URL""",
'category': 'Sales',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['base', 'product'],
'data': ['views/product_inherit_view.xml'],
'demo': [],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

22
product_image_url/models/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
import product_inherit

49
product_image_url/models/product_inherit.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
###################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
import base64
import urllib2
import requests
from PIL import Image
from StringIO import StringIO
from odoo import models, fields, api, _
from odoo.exceptions import Warning
class ProductImageUrl(models.Model):
_inherit = 'product.template'
web_url = fields.Char(string='Image URL', help='Automatically sanitized HTML contents', copy=False)
@api.onchange('web_url')
def onchange_image(self):
link = self.web_url
try:
if link:
r = requests.get(link)
Image.open(StringIO(r.content))
profile_image = base64.encodestring(urllib2.urlopen(link).read())
val = {
'image_medium': profile_image,
}
return {'value': val}
except:
raise Warning("Please provide correct URL or check your image size.!")

BIN
product_image_url/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

BIN
product_image_url/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
product_image_url/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
product_image_url/static/description/image_url.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

105
product_image_url/static/description/index.html

@ -0,0 +1,105 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Product Image From URL</h2>
<h3 class="oe_slogan"></h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
</div>
<div class="oe_row oe_spaced" style="padding-left:65px;">
<div>
<span style="color:green;"> &#9745; </span> Product Images from Internet.<br/>
<span style="color:green;"> &#9745; </span> Just copy the image address & paste it in "Image URL" field.<br/>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32 text-justify" style="text-align: center;">
This Cybrosys's module allows you to easily attach partner image directly from the internet.
You don't need to bother the product for an image.
Just Google the product's name and identify & select it's photo. Copy the image URL and paste in image URL field in Odoo.
This module will attach the corresponding photo in partner form.
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Search Images with your product's name</h4>
<p>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;height:400px;" src="image_url.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Paste the Image URL in Product Form</h4>
<p>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="product_form.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Warning Message for un supported image address</h4>
<p>
</div>
<div class="oe_row oe_spaced" style="padding-left:65px;">
<span style="color:green;"> &#9885; </span> In case of video data url.<br/>
<span style="color:green;"> &#9885; </span> In case of unsupported file format.<br/>
<span style="color:green;"> &#9885; </span> In case of image size is too large.<br/>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="warning.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></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;padding-left: 3px;"></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;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></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;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
product_image_url/static/description/product_form.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
product_image_url/static/description/warning.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

13
product_image_url/views/product_inherit_view.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="product_inherit_form_view">
<field name="name">product.template.inherit.form.view</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="type" position="after">
<field name="web_url" class="oe_edit_only"/>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save