diff --git a/.travis.yml b/.travis.yml index 9f27f9d9ba..037d54399f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,8 @@ virtualenv: system_site_packages: true before_install: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" install: - git clone https://github.com/OCA/maintainer-quality-tools.git $HOME/maintainer-quality-tools @@ -33,6 +33,7 @@ install: - travis_install_nightly - git clone https://github.com/OCA/sale-workflow $HOME/sale-workflow -b ${VERSION} - git clone https://github.com/OCA/bank-statement-reconcile $HOME/bank-statement-reconcile -b ${VERSION} + - git clone https://github.com/OCA/product-attribute $HOME/product-attribute -b ${VERSION} script: - travis_run_tests diff --git a/website_sale_product_brand/README.rst b/website_sale_product_brand/README.rst new file mode 100644 index 0000000000..b023615f4a --- /dev/null +++ b/website_sale_product_brand/README.rst @@ -0,0 +1,66 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +========================== +Website Sale Product Brand +========================== + +Description +=========== + +This module was written to extend the functionality of product filtering on website. +It will allow you to filter product based on its brand. + +This Module depends on product_brand module : +->https://github.com/OCA/product-attribute/tree/8.0/product_brand + +While shopping online, we have seen various eShops having a feature to shop by brands +which ODOO does not yet provide officially.Website Sale Product Brand fills the gap at certain +extent and by providing basic search by brands, thus reducing end-user’s efforts in +searching the products he/she wants to purchase. + +Usage +===== + +To use this module, you need to: + +- Create Product brand, to create product brand + go to: + sales>products>product brands +- Select Product brand in product. + +Based on this configuration, you will see the menuitem shop by brand under shop menu. +It will show all the brands and once you select that brand it will show product's which +is related to this brand. + +For further information, please visit: + +https://www.odoo.com/forum/help-1 +The blog here explains the HOWTO : + http://www.serpentcs.com/serpentcs-odoo-ecommerce-shop-brands-contribution +The Youtube Video is here : + https://www.youtube.com/watch?feature=player_embedded&v=LkV5umivylw + +Credits +======= + +Contributors +------------ + +* Jay Vora +* Meet Dholakia + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/website_sale_product_brand/__init__.py b/website_sale_product_brand/__init__.py new file mode 100644 index 0000000000..29c3ac599b --- /dev/null +++ b/website_sale_product_brand/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## + +from . import controllers +from . import models diff --git a/website_sale_product_brand/__openerp__.py b/website_sale_product_brand/__openerp__.py new file mode 100644 index 0000000000..24a37a5143 --- /dev/null +++ b/website_sale_product_brand/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## + +{ + 'name': 'Product Brand Filtering in Website', + 'category': 'e-commerce', + 'author': "Serpent Consulting Services Pvt. Ltd," + "Odoo Community Association (OCA)", + 'website': 'http://www.serpentcs.com', + 'version': '8.0.1.0.0', + 'depends': [ + 'product_brand', + 'website_sale' + ], + 'data': [ + "security/ir.model.access.csv", + "views/product_brand.xml", + ], + 'installable': True, + 'auto_install': False, +} diff --git a/website_sale_product_brand/controllers/__init__.py b/website_sale_product_brand/controllers/__init__.py new file mode 100644 index 0000000000..ebd700982e --- /dev/null +++ b/website_sale_product_brand/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## + +from . import main diff --git a/website_sale_product_brand/controllers/main.py b/website_sale_product_brand/controllers/main.py new file mode 100644 index 0000000000..d5e5cfdb8a --- /dev/null +++ b/website_sale_product_brand/controllers/main.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## + +import openerp +from openerp import http +from openerp.http import request +from openerp import SUPERUSER_ID +from openerp.addons.website_sale.controllers.main import QueryURL +from openerp.addons.website_sale.controllers.main import website_sale + + +class WebsiteSale(website_sale): + + @http.route(['/shop', + '/shop/page/', + '/shop/category/', + """/shop/category/ + /page/""", + '/shop/brands'], + type='http', + auth='public', + website=True) + def shop(self, page=0, category=None, brand=None, search='', **post): + if brand: + request.context.setdefault('brand_id', int(brand)) + result = super(WebsiteSale, self).shop(page=page, category=category, + brand=brand, search=search, + **post) + result.qcontext['brand'] = brand + return result + + # Method to get the brands. + @http.route( + ['/page/product_brands'], + type='http', + auth='public', + website=True) + def product_brands(self, **post): + cr, context, pool = (request.cr, + request.context, + request.registry) + b_obj = pool['product.brand'] + domain = [] + if post.get('search'): + domain += [('name', 'ilike', post.get('search'))] + brand_ids = b_obj.search(cr, SUPERUSER_ID, domain) + brand_rec = b_obj.browse(cr, SUPERUSER_ID, brand_ids, context=context) + + keep = QueryURL('/page/product_brands', brand_id=[]) + values = {'brand_rec': brand_rec, + 'keep': keep} + if post.get('search'): + values.update({'search': post.get('search')}) + return request.website.render( + 'website_sale_product_brand.product_brands', + values) + +openerp.addons.website_sale.controllers.main.website_sale = WebsiteSale diff --git a/website_sale_product_brand/models/__init__.py b/website_sale_product_brand/models/__init__.py new file mode 100644 index 0000000000..705ebfad63 --- /dev/null +++ b/website_sale_product_brand/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## + +from . import website diff --git a/website_sale_product_brand/models/website.py b/website_sale_product_brand/models/website.py new file mode 100644 index 0000000000..0f0902015c --- /dev/null +++ b/website_sale_product_brand/models/website.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## + +from openerp.osv import orm +from openerp.http import request + + +class WebSite(orm.Model): + _inherit = 'website' + + def sale_product_domain(self, cr, uid, ids, context=None): + domain = super(WebSite, self).sale_product_domain(cr, uid, ids=ids, + context=context) + if 'brand_id' in request.env.context: + domain.append( + ('product_brand_id', '=', request.env.context['brand_id'])) + return domain diff --git a/website_sale_product_brand/security/ir.model.access.csv b/website_sale_product_brand/security/ir.model.access.csv new file mode 100644 index 0000000000..f48fe4f3ca --- /dev/null +++ b/website_sale_product_brand/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_brand_public,public.product.brand,product_brand.model_product_brand,base.group_public,1,0,0,0 diff --git a/website_sale_product_brand/static/description/icon.png b/website_sale_product_brand/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/website_sale_product_brand/static/description/icon.png differ diff --git a/website_sale_product_brand/views/product_brand.xml b/website_sale_product_brand/views/product_brand.xml new file mode 100644 index 0000000000..346a14f0e4 --- /dev/null +++ b/website_sale_product_brand/views/product_brand.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + Shop All + /shop + + + + + Shop by Brand + /page/product_brands + + + + +