diff --git a/product_image_url/README.rst b/product_image_url/README.rst new file mode 100644 index 000000000..e96d1ca22 --- /dev/null +++ b/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 + +Author +------ +Developer: Nilmar Shereef @ cybrosys, shereef@cybrosys.in + diff --git a/product_image_url/__init__.py b/product_image_url/__init__.py new file mode 100644 index 000000000..3e7455c64 --- /dev/null +++ b/product_image_url/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# +# 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 . +# +################################################################################### +import models diff --git a/product_image_url/__manifest__.py b/product_image_url/__manifest__.py new file mode 100644 index 000000000..18ece0d1b --- /dev/null +++ b/product_image_url/__manifest__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# +# 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 . +# +################################################################################### +{ + '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, +} + + diff --git a/product_image_url/models/__init__.py b/product_image_url/models/__init__.py new file mode 100644 index 000000000..f7757d00a --- /dev/null +++ b/product_image_url/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# +# 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 . +# +################################################################################### +import product_inherit diff --git a/product_image_url/models/product_inherit.py b/product_image_url/models/product_inherit.py new file mode 100644 index 000000000..7ebd5b61b --- /dev/null +++ b/product_image_url/models/product_inherit.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# +# 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 . +# +################################################################################### +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.!") diff --git a/product_image_url/static/description/banner.jpg b/product_image_url/static/description/banner.jpg new file mode 100644 index 000000000..07f13e1b6 Binary files /dev/null and b/product_image_url/static/description/banner.jpg differ diff --git a/product_image_url/static/description/cybro_logo.png b/product_image_url/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/product_image_url/static/description/cybro_logo.png differ diff --git a/product_image_url/static/description/icon.png b/product_image_url/static/description/icon.png new file mode 100644 index 000000000..7f6a97678 Binary files /dev/null and b/product_image_url/static/description/icon.png differ diff --git a/product_image_url/static/description/image_url.png b/product_image_url/static/description/image_url.png new file mode 100644 index 000000000..72915feb6 Binary files /dev/null and b/product_image_url/static/description/image_url.png differ diff --git a/product_image_url/static/description/index.html b/product_image_url/static/description/index.html new file mode 100644 index 000000000..712c1d340 --- /dev/null +++ b/product_image_url/static/description/index.html @@ -0,0 +1,105 @@ +
+
+

Product Image From URL

+

+

Cybrosys Technologies

+
+
+
+ Product Images from Internet.
+ Just copy the image address & paste it in "Image URL" field.
+
+
+
+ +
+
+
+

Overview

+

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

+
+
+
+ +
+
+
+

+

Search Images with your product's name

+

+

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

+

Paste the Image URL in Product Form

+

+

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

+

Warning Message for un supported image address

+

+

+
+ In case of video data url.
+ In case of unsupported file format.
+ In case of image size is too large.
+
+
+
+ +
+
+
+
+ + +
+

Need Any Help?

+ +
+ diff --git a/product_image_url/static/description/product_form.png b/product_image_url/static/description/product_form.png new file mode 100644 index 000000000..edc2a6a8b Binary files /dev/null and b/product_image_url/static/description/product_form.png differ diff --git a/product_image_url/static/description/warning.png b/product_image_url/static/description/warning.png new file mode 100644 index 000000000..2f8bd915c Binary files /dev/null and b/product_image_url/static/description/warning.png differ diff --git a/product_image_url/views/product_inherit_view.xml b/product_image_url/views/product_inherit_view.xml new file mode 100644 index 000000000..a06a991f0 --- /dev/null +++ b/product_image_url/views/product_inherit_view.xml @@ -0,0 +1,13 @@ + + + + product.template.inherit.form.view + product.template + + + + + + + +