diff --git a/partner_image_url/README.rst b/partner_image_url/README.rst new file mode 100644 index 000000000..903f0884a --- /dev/null +++ b/partner_image_url/README.rst @@ -0,0 +1,31 @@ +Partner Image URL v10 +===================== +This Cybrosys's module allows you to easily attach partner image directly from the internet. +You don't need to bother the partner for an image. +Just Google the partner's name and identify & select his photo. Copy the image URL and paste in image URL field in Odoo. +This module will attach the corresponding photo in partner profile. + +Features +======== +* Customer/Supplier 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 +------ +Credits +======= +Developer: Nilmar Shereef @ cybrosys, shereef@cybrosys.in + diff --git a/partner_image_url/__init__.py b/partner_image_url/__init__.py new file mode 100644 index 000000000..f0c1cf4f4 --- /dev/null +++ b/partner_image_url/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import models diff --git a/partner_image_url/__manifest__.py b/partner_image_url/__manifest__.py new file mode 100644 index 000000000..e9bd1ad18 --- /dev/null +++ b/partner_image_url/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Partner Image Url', + 'version': '10.0.1.0', + 'summary': """Customer/Vendor Images from Web URL""", + 'description': """Customer/Vendor 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'], + 'data': [ + 'views/partner_inherit_view.xml', + ], + 'demo': [], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} + diff --git a/partner_image_url/models/__init__.py b/partner_image_url/models/__init__.py new file mode 100644 index 000000000..e544217de --- /dev/null +++ b/partner_image_url/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import res_partner_inherit + diff --git a/partner_image_url/models/res_partner_inherit.py b/partner_image_url/models/res_partner_inherit.py new file mode 100644 index 000000000..878491188 --- /dev/null +++ b/partner_image_url/models/res_partner_inherit.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nilmar Shereef() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) 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 HrEmployeeDocument(models.Model): + _inherit = 'res.partner' + + 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': profile_image, + } + return {'value': val} + except: + raise Warning("Please provide correct URL or check your image size.!") + diff --git a/partner_image_url/static/description/banner.jpg b/partner_image_url/static/description/banner.jpg new file mode 100644 index 000000000..7d9572a3b Binary files /dev/null and b/partner_image_url/static/description/banner.jpg differ diff --git a/partner_image_url/static/description/cybro_logo.png b/partner_image_url/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/partner_image_url/static/description/cybro_logo.png differ diff --git a/partner_image_url/static/description/icon.png b/partner_image_url/static/description/icon.png new file mode 100644 index 000000000..d9d91bee4 Binary files /dev/null and b/partner_image_url/static/description/icon.png differ diff --git a/partner_image_url/static/description/image_from_url_2.png b/partner_image_url/static/description/image_from_url_2.png new file mode 100644 index 000000000..c4e31419b Binary files /dev/null and b/partner_image_url/static/description/image_from_url_2.png differ diff --git a/partner_image_url/static/description/image_from_url_3.png b/partner_image_url/static/description/image_from_url_3.png new file mode 100644 index 000000000..ae3532a6d Binary files /dev/null and b/partner_image_url/static/description/image_from_url_3.png differ diff --git a/partner_image_url/static/description/image_url_1.png b/partner_image_url/static/description/image_url_1.png new file mode 100644 index 000000000..caf0f6ccc Binary files /dev/null and b/partner_image_url/static/description/image_url_1.png differ diff --git a/partner_image_url/static/description/index.html b/partner_image_url/static/description/index.html new file mode 100644 index 000000000..f4c69382a --- /dev/null +++ b/partner_image_url/static/description/index.html @@ -0,0 +1,118 @@ +
+
+

Partner Image URL

+

+

Cybrosys Technologies

+
+
+
+ Customer/Supplier 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 partner for an image. + Just Google the partner's name and identify & select his photo. Copy the image URL and paste in image URL field in Odoo. + This module will attach the corresponding photo in partner profile. +

+
+
+
+ +
+
+
+

+

Search Images with your partner's name

+

+

+
+
+ +
+
+
+ Or +
+
+
+ +
+
+
+
+ +
+
+
+

+

Paste the Image URL in Customer 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/partner_image_url/static/description/partner_form.png b/partner_image_url/static/description/partner_form.png new file mode 100644 index 000000000..d99c3b236 Binary files /dev/null and b/partner_image_url/static/description/partner_form.png differ diff --git a/partner_image_url/static/description/warning.png b/partner_image_url/static/description/warning.png new file mode 100644 index 000000000..2f8bd915c Binary files /dev/null and b/partner_image_url/static/description/warning.png differ diff --git a/partner_image_url/views/partner_inherit_view.xml b/partner_image_url/views/partner_inherit_view.xml new file mode 100644 index 000000000..9147e72ab --- /dev/null +++ b/partner_image_url/views/partner_inherit_view.xml @@ -0,0 +1,14 @@ + + + + res.partner.inherit.form.view + res.partner + + + + + + + + +