diff --git a/website_product_attachments/README.rst b/website_product_attachments/README.rst new file mode 100644 index 000000000..e9fac02d0 --- /dev/null +++ b/website_product_attachments/README.rst @@ -0,0 +1,43 @@ +Product Attachments On Website +============================== +This Module allows customer to download documents +that are attached to the products from website + + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: Fasluca V10@ cybrosys, Contact: odoo@cybrosys.com + Kavya Raveendran V11@ cybrosys, Contact: odoo@cybrosys.com + Kavya Raveendran V12 @ cybrosys, Contact: odoo@cybrosys.com + Yadhukrishna V13 @cybrosys, odoo@cybrosys.com + JIBIN JAMES V14@cybrosys, Contact: odoo@cybrosys.com + Remya Rajeev V15@cybrosys, Contact: odoo@cybrosys.com +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://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/website_product_attachments/__init__.py b/website_product_attachments/__init__.py new file mode 100644 index 000000000..0d633edaa --- /dev/null +++ b/website_product_attachments/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Fasluca @ 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 . +# +############################################################################# +# -*- coding: utf-8 -*- +from . import controllers diff --git a/website_product_attachments/__manifest__.py b/website_product_attachments/__manifest__.py new file mode 100644 index 000000000..0179c4917 --- /dev/null +++ b/website_product_attachments/__manifest__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-TODAY Cybrosys Technologies(). +# Author: Fasluca @ 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': 'Product Attachments on Website', + 'version': '15.0.1.0.0', + 'summary': """This Module Allows Customer to Download Documents + That Are Attached to the Products From Website""", + 'description': 'This Module allows customer to download documents ' + 'that are attached to the products from website', + 'category': 'Website', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['website_sale'], + 'data': ['views/template.xml'], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/website_product_attachments/controllers/__init__.py b/website_product_attachments/controllers/__init__.py new file mode 100644 index 000000000..477b5b4fd --- /dev/null +++ b/website_product_attachments/controllers/__init__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: v10.0 Fasluca @ cybrosys,(odoo@cybrosys.com) +# v11.0 Kavya Raveendran @ cybrosys,(odoo@cybrosys.com) +# v12.0 Kavya Raveendran @ cybrosys,(odoo@cybrosys.com) +# v13.0 Yadhukrishna @ cybrosys,(odoo@cybrosys.com) +# v14.0 Jibin James @ cybrosys,(odoo@cybrosys.com) +# v15.0 Remya Rajeev @ 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 . +# +############################################################################# +# -*- coding: utf-8 -*- +from . import website_product_attachment diff --git a/website_product_attachments/controllers/website_product_attachment.py b/website_product_attachments/controllers/website_product_attachment.py new file mode 100644 index 000000000..84c9d08b8 --- /dev/null +++ b/website_product_attachments/controllers/website_product_attachment.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Fasluca @ 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 . +# +############################################################################# +# -*- coding: utf-8 -*- + +import base64 +from werkzeug.utils import redirect +import io +from odoo import http +from odoo.http import request +from odoo.addons.website.controllers.main import QueryURL +from odoo.addons.website_sale.controllers.main import WebsiteSale + + +class WebsiteSale(WebsiteSale): + + @http.route(['/shop/'], type='http', auth="public", website=True) + def product(self, product, category='', search='', **kwargs): + product_context = dict(request.env.context, active_id=product.id) + ProductCategory = request.env['product.public.category'] + Rating = request.env['rating.rating'].sudo() + if category: + category = ProductCategory.browse(int(category)).exists() + + attrib_list = request.httprequest.args.getlist('attrib') + attrib_values = [map(int, v.split("-")) for v in attrib_list if v] + attrib_set = set([v[1] for v in attrib_values]) + keep = QueryURL('/shop', category=category and category.id, search=search, attrib=attrib_list) + categs = ProductCategory.search([('parent_id', '=', False)]) + pricelist = request.website.get_current_pricelist() + from_currency = request.env.user.company_id.currency_id + to_currency = pricelist.currency_id + compute_currency = lambda price: from_currency.compute(price, to_currency) + # get the rating attached to a mail.message, and the rating stats of the product + ratings = Rating.search([('message_id', 'in', product.website_message_ids.ids)]) + rating_message_values = dict([(record.message_id.id, record.rating) for record in ratings]) + if not product_context.get('pricelist'): + product_context['pricelist'] = pricelist.id + product = product.with_context(product_context) + + attachments = request.env['ir.attachment'].sudo().search( + [('res_model', '=', 'product.template'), + ('res_id', '=', product.id)], order='id') + + values = { + 'search': search, + 'category': category, + 'pricelist': pricelist, + 'attrib_values': attrib_values, + 'compute_currency': compute_currency, + 'attrib_set': attrib_set, + 'keep': keep, + 'categories': categs, + 'main_object': product, + 'product': product, + '_get_attribute_exclusions': self._get_attribute_exclusion, + 'rating_message_values': rating_message_values, + 'attachments': attachments + } + return request.render("website_sale.product", values) + + def _get_attribute_exclusion(self, product, reference_product=None): + parent_combination = request.env['product.template.attribute.value'] + if reference_product: + parent_combination |= reference_product.product_template_attribute_value_ids + if reference_product.env.context.get('no_variant_attribute_values'): + # Add "no_variant" attribute values' exclusions + # They are kept in the context since they are not linked to this product variant + parent_combination |= reference_product.env.context.get('no_variant_attribute_values') + return product._get_attribute_exclusions(parent_combination) + + @http.route(['/attachment/download',], type='http', auth='public') + def download_attachment(self, attachment_id): + # Check if this is a valid attachment id + attachment = request.env['ir.attachment'].sudo().search([('id', '=', int(attachment_id))]) + + if attachment: + attachment = attachment[0] + else: + return redirect('/shop') + + if attachment["type"] == "url": + if attachment["url"]: + return redirect(attachment["url"]) + else: + return request.not_found() + elif attachment["datas"]: + data = io.BytesIO(base64.standard_b64decode(attachment["datas"])) + return http.send_file(data, filename=attachment['name'], as_attachment=True) + else: + return request.not_found() + + + diff --git a/website_product_attachments/doc/RELEASE_NOTES.md b/website_product_attachments/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..627bda252 --- /dev/null +++ b/website_product_attachments/doc/RELEASE_NOTES.md @@ -0,0 +1,8 @@ +## Module + +#### 18.09.2020 +#### Version 15.0.1.0.0 +#### ADD +Initial Commit for website_product_attachments. + + diff --git a/website_product_attachments/static/description/assets/icons/check.png b/website_product_attachments/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/check.png differ diff --git a/website_product_attachments/static/description/assets/icons/chevron.png b/website_product_attachments/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/chevron.png differ diff --git a/website_product_attachments/static/description/assets/icons/cogs.png b/website_product_attachments/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/cogs.png differ diff --git a/website_product_attachments/static/description/assets/icons/consultation.png b/website_product_attachments/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/consultation.png differ diff --git a/website_product_attachments/static/description/assets/icons/ecom-black.png b/website_product_attachments/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/ecom-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/education-black.png b/website_product_attachments/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/education-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/hotel-black.png b/website_product_attachments/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/hotel-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/license.png b/website_product_attachments/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/license.png differ diff --git a/website_product_attachments/static/description/assets/icons/lifebuoy.png b/website_product_attachments/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/lifebuoy.png differ diff --git a/website_product_attachments/static/description/assets/icons/logo.png b/website_product_attachments/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/logo.png differ diff --git a/website_product_attachments/static/description/assets/icons/manufacturing-black.png b/website_product_attachments/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/manufacturing-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/pos-black.png b/website_product_attachments/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/pos-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/puzzle.png b/website_product_attachments/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/puzzle.png differ diff --git a/website_product_attachments/static/description/assets/icons/restaurant-black.png b/website_product_attachments/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/restaurant-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/service-black.png b/website_product_attachments/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/service-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/trading-black.png b/website_product_attachments/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/trading-black.png differ diff --git a/website_product_attachments/static/description/assets/icons/training.png b/website_product_attachments/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/training.png differ diff --git a/website_product_attachments/static/description/assets/icons/update.png b/website_product_attachments/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/update.png differ diff --git a/website_product_attachments/static/description/assets/icons/user.png b/website_product_attachments/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/user.png differ diff --git a/website_product_attachments/static/description/assets/icons/wrench.png b/website_product_attachments/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/website_product_attachments/static/description/assets/icons/wrench.png differ diff --git a/website_product_attachments/static/description/assets/screenshots/hero.png b/website_product_attachments/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..f18c4d6ef Binary files /dev/null and b/website_product_attachments/static/description/assets/screenshots/hero.png differ diff --git a/website_product_attachments/static/description/assets/screenshots/screenshot1.png b/website_product_attachments/static/description/assets/screenshots/screenshot1.png new file mode 100644 index 000000000..1b3d70855 Binary files /dev/null and b/website_product_attachments/static/description/assets/screenshots/screenshot1.png differ diff --git a/website_product_attachments/static/description/assets/screenshots/screenshot2.png b/website_product_attachments/static/description/assets/screenshots/screenshot2.png new file mode 100644 index 000000000..dd53aed70 Binary files /dev/null and b/website_product_attachments/static/description/assets/screenshots/screenshot2.png differ diff --git a/website_product_attachments/static/description/assets/screenshots/screenshot3.png b/website_product_attachments/static/description/assets/screenshots/screenshot3.png new file mode 100644 index 000000000..f18c4d6ef Binary files /dev/null and b/website_product_attachments/static/description/assets/screenshots/screenshot3.png differ diff --git a/website_product_attachments/static/description/banner.png b/website_product_attachments/static/description/banner.png new file mode 100644 index 000000000..e6bee65a9 Binary files /dev/null and b/website_product_attachments/static/description/banner.png differ diff --git a/website_product_attachments/static/description/cybro_logo.png b/website_product_attachments/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/website_product_attachments/static/description/cybro_logo.png differ diff --git a/website_product_attachments/static/description/icon.png b/website_product_attachments/static/description/icon.png new file mode 100644 index 000000000..ce215758e Binary files /dev/null and b/website_product_attachments/static/description/icon.png differ diff --git a/website_product_attachments/static/description/index.html b/website_product_attachments/static/description/index.html new file mode 100644 index 000000000..eccbe2f9e --- /dev/null +++ b/website_product_attachments/static/description/index.html @@ -0,0 +1,598 @@ +
+
+
+

+ Product Attachments on Website

+

+ Download Attachments of Products from Website +

+ +
+
+ + + + +
+
+

+ Overview +

+
+ +
+

+ This Module allows customers to download documents from website that are attached to relevant + products. +

+ +
+
+ + +
+
+

+ Configuration +

+
+ +
+

+ No additional configuration required. +

+ +
+
+ +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Attach Documents

+

+ Allows users to attach documents.

+
+
+ +
+
+ +
+
+

+ Attachments from Website

+

+ Download attachments from website.

+
+
+
+ +
+
+

+ Screenshots +

+
+ +
+

+ Attach Documents on Product Master

+

+ Attach your documents like, product specification on product master.

+ +
+ +
+

+ Attach Multiple Documents

+

+ Allow to attach multiple documents for products.

+ +
+ + +
+

+ Visitors Can Download Attachments

+

+ Visitors of your e-commerce portal can download these attachments.

+ +
+ +
+ + +
+
+

Suggested Products

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

Our Services

+
+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

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

Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/website_product_attachments/views/template.xml b/website_product_attachments/views/template.xml new file mode 100644 index 000000000..3a1cb8eb4 --- /dev/null +++ b/website_product_attachments/views/template.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file