From 3cdc8f3de737f7cc23c1a1b2fc3a8a089e9ae7d5 Mon Sep 17 00:00:00 2001 From: "Serpent Consulting Services Pvt. Ltd" Date: Wed, 25 Mar 2015 20:36:26 +0530 Subject: [PATCH 01/14] [ADD] : Added website_product_brnd module --- website_product_brand/ChangeLog.txt | 6 + website_product_brand/__init__.py | 24 ++ website_product_brand/__openerp__.py | 45 ++++ website_product_brand/controllers/__init__.py | 24 ++ website_product_brand/controllers/main.py | 248 ++++++++++++++++++ .../security/ir.model.access.csv | 2 + .../static/description/icon.png | Bin 0 -> 16349 bytes website_product_brand/views/product_brand.xml | 64 +++++ 8 files changed, 413 insertions(+) create mode 100644 website_product_brand/ChangeLog.txt create mode 100644 website_product_brand/__init__.py create mode 100644 website_product_brand/__openerp__.py create mode 100644 website_product_brand/controllers/__init__.py create mode 100644 website_product_brand/controllers/main.py create mode 100644 website_product_brand/security/ir.model.access.csv create mode 100644 website_product_brand/static/description/icon.png create mode 100644 website_product_brand/views/product_brand.xml diff --git a/website_product_brand/ChangeLog.txt b/website_product_brand/ChangeLog.txt new file mode 100644 index 0000000000..521d692234 --- /dev/null +++ b/website_product_brand/ChangeLog.txt @@ -0,0 +1,6 @@ +=================================================================== +Maintaining the changelog of the module for each commit. +=================================================================== + +1.0 : Vimesh Chaudhari - Serpent Consulting Services Pvt Ltd. + * Added the module. diff --git a/website_product_brand/__init__.py b/website_product_brand/__init__.py new file mode 100644 index 0000000000..1d2fc26d1f --- /dev/null +++ b/website_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 +# +############################################################################## + +import controllers + +# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/website_product_brand/__openerp__.py b/website_product_brand/__openerp__.py new file mode 100644 index 0000000000..a529c11b11 --- /dev/null +++ b/website_product_brand/__openerp__.py @@ -0,0 +1,45 @@ +# -*- 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': 'Website', + 'author': 'Serpent Consulting Services Pvt Ltd', + 'website':'http://www.serpentcs.com', + 'summary': '', + 'version': '1.0', + 'description': """ +Allows to use product brands as filtering for products in website.\n +This Module depends on product_brand module -https://github.com/OCA/product-attribute/tree/8.0/product_brand\n +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 + + """, + 'depends': ['product_brand','website_sale'], + 'data': [ + "security/ir.model.access.csv", + "views/product_brand.xml", + ], + 'installable': True, + 'auto_install': False, +} + +# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/website_product_brand/controllers/__init__.py b/website_product_brand/controllers/__init__.py new file mode 100644 index 0000000000..f3dda2ff20 --- /dev/null +++ b/website_product_brand/controllers/__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 +# +############################################################################## + +import main + +# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py new file mode 100644 index 0000000000..7b39a87b19 --- /dev/null +++ b/website_product_brand/controllers/main.py @@ -0,0 +1,248 @@ +# -*- 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 werkzeug +from openerp import http +from openerp.http import request +import openerp.addons.website_sale.controllers.main +from openerp import http, SUPERUSER_ID +import werkzeug +from openerp.tools.translate import _ +from openerp.addons.website.models.website import slug +from gi.overrides.keysyms import currency +PPG = 20 +PPR = 4 + +class table_compute(object): + + def __init__(self): + self.table = {} + + def _check_place(self, posx, posy, sizex, sizey): + res = True + for y in range(sizey): + for x in range(sizex): + if posx + x >= PPR: + res = False + break + row = self.table.setdefault(posy + y, {}) + if row.setdefault(posx + x) is not None: + res = False + break + + for x in range(PPR): + self.table[posy + y].setdefault(x, None) + + return res + + def process(self, products): + minpos = 0 + index = 0 + maxy = 0 + for p in products: + x = min(max(p.website_size_x, 1), PPR) + y = min(max(p.website_size_y, 1), PPR) + if index > PPG: + x = y = 1 + pos = minpos + while not self._check_place(pos % PPR, pos / PPR, x, y): + pos += 1 + + if index > PPG and pos / PPR > maxy: + break + if x == 1 and y == 1: + minpos = pos / PPR + for y2 in range(y): + for x2 in range(x): + self.table[pos / PPR + y2][pos % PPR + x2] = False + + self.table[pos / PPR][pos % PPR] = {'product': p, + 'x': x, + 'y': y, + 'class': ' '.join(map(lambda x: x.html_class or '', p.website_style_ids))} + if index <= PPG: + maxy = max(maxy, y + pos / PPR) + index += 1 + + rows = self.table.items() + rows.sort() + rows = map(lambda x: x[1], rows) + for col in range(len(rows)): + cols = rows[col].items() + cols.sort() + x += len(cols) + rows[col] = [ c for c in map(lambda x: x[1], cols) if c != False ] + + return rows + + +class QueryURL(object): + + def __init__(self, path = '', **args): + self.path = path + self.args = args + + def __call__(self, path = None, **kw): + if not path: + path = self.path + for k, v in self.args.items(): + kw.setdefault(k, v) + + l = [] + for k, v in kw.items(): + if v: + if isinstance(v, list) or isinstance(v, set): + l.append(werkzeug.url_encode([ (k, i) for i in v ])) + else: + l.append(werkzeug.url_encode([(k, v)])) + + if l: + path += '?' + '&'.join(l) + return path + + +class website_sale(openerp.addons.website_sale.controllers.main.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, search = '', **post): + cr, uid, context, pool = (request.cr, + request.uid, + request.context, + request.registry) + values = {} + child_prod_id = [] + domain = request.website.sale_product_domain() + if search: + domain += ['|', + '|', + '|', + ('name', 'ilike', search), + ('description', 'ilike', search), + ('description_sale', 'ilike', search), + ('product_variant_ids.default_code', 'ilike', search)] + if category: + domain += [('public_categ_ids', 'child_of', int(category))] + 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 ]) + if attrib_values: + attrib = None + ids = [] + for value in attrib_values: + if not attrib: + attrib = value[0] + ids.append(value[1]) + elif value[0] == attrib: + ids.append(value[1]) + else: + domain += [('attribute_line_ids.value_ids', 'in', ids)] + attrib = value[0] + ids = [value[1]] + + if attrib: + domain += [('attribute_line_ids.value_ids', 'in', ids)] + keep = QueryURL('/shop', category=category and int(category), search=search, attrib=attrib_list) + if not context.get('pricelist'): + pricelist = self.get_pricelist() + context['pricelist'] = int(pricelist) + else: + pricelist = pool.get('product.pricelist').browse(cr, uid, context['pricelist'], context) + product_obj = pool.get('product.template') + + # Brand's product search + if post.get('brand'): + product_designer_obj = pool.get('product.brand') + brand_ids = product_designer_obj.search(cr, SUPERUSER_ID, [('id', '=', int(post.get('brand')))]) + domain = [('product_brand_id', 'in', brand_ids)] + url = '/shop' + product_count = product_obj.search_count(cr, uid, domain, context=context) + if search: + post['search'] = search + if category: + category = pool['product.public.category'].browse(cr, uid, int(category), context=context) + url = '/shop/category/%s' % slug(category) + pager = request.website.pager(url=url, total=product_count, page=page, step=PPG, scope=7, url_args=post) + product_ids = product_obj.search(cr, uid, domain, limit=PPG, offset=pager['offset'], order='website_published desc, website_sequence desc', context=context) + products = product_obj.browse(cr, uid, product_ids, context=context) + style_obj = pool['product.style'] + style_ids = style_obj.search(cr, uid, [], context=context) + styles = style_obj.browse(cr, uid, style_ids, context=context) + category_obj = pool['product.public.category'] + category_ids = category_obj.search(cr, uid, [], context=context) + categories = category_obj.browse(cr, uid, category_ids, context=context) + categs = filter(lambda x: not x.parent_id, categories) + if category: + selected_id = int(category) + child_prod_ids = category_obj.search(cr, uid, [('parent_id', '=', selected_id)], context=context) + children_ids = category_obj.browse(cr, uid, child_prod_ids) + values.update({'child_list': children_ids}) + attributes_obj = request.registry['product.attribute'] + attributes_ids = attributes_obj.search(cr, uid, [], context=context) + attributes = attributes_obj.browse(cr, uid, attributes_ids, context=context) + from_currency = pool.get('product.price.type')._get_field_currency(cr, uid, 'list_price', context) + to_currency = pricelist.currency_id + compute_currency = lambda price: pool['res.currency']._compute(cr, uid, from_currency, to_currency, price, context=context) + values.update({'search': search, + 'category': category, + 'attrib_values': attrib_values, + 'attrib_set': attrib_set, + 'pager': pager, + 'pricelist': pricelist, + 'products': products, + 'bins': table_compute().process(products), + 'rows': PPR, + 'styles': styles, + 'categories': categs, + 'attributes': attributes, + 'compute_currency': compute_currency, + 'keep': keep, + 'style_in_product': lambda style, product: style.id in [ s.id for s in product.website_style_ids ], + 'attrib_encode': lambda attribs: werkzeug.url_encode([ ('attrib', i) for i in attribs ])}) + return request.website.render('website_sale.products', values) + + #Method to get the brands. + @http.route(['/page/product_brands'], type='http', auth='public', website=True) + def product_brands(self, **post): + cr, uid, context, pool = (request.cr, + request.uid, + request.context, + request.registry) + brand_values = [] + brand_obj = pool['product.brand'] + domain = [] + if post.get('search'): + domain += [('name', 'ilike', post.get('search'))] + brand_ids = brand_obj.search(cr, SUPERUSER_ID, domain) + for brand_rec in brand_obj.browse(cr, SUPERUSER_ID, brand_ids, context=context): + brand_values.append(brand_rec) + + keep = QueryURL('/page/product_brands', brand_id=[]) + values = {'brand_rec': brand_values, + 'keep': keep} + if post.get('search'): + values.update({'search': post.get('search')}) + return request.website.render('website_product_brand.product_brands', values) + +# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/website_product_brand/security/ir.model.access.csv b/website_product_brand/security/ir.model.access.csv new file mode 100644 index 0000000000..f48fe4f3ca --- /dev/null +++ b/website_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_product_brand/static/description/icon.png b/website_product_brand/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..53dd30d963540cd1eee217c8db5ee89277fab319 GIT binary patch literal 16349 zcmV<3KO(@1P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ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ae(UOfIJ9+&N**JBw!XOXyX%Ta?S9qhxz^ik%=}D}tUAGGSrv7t z$*-!=syq1jr?0&kf==+g*LxJ=j@-8`fZYpv zT30Tn957M?x#)iezSr3HOj2Twl%g={17~r~POS1IX2w(-hdBsp034>-I2lkB@@Ak- zCU#(rFQp#GJ~gLGXqn7t##Gs9+ix$KdjnaWXt+_xNad7a%R~| z);%b@pMmcZ|cGs~IRO f)lU1rvH|}EKNQpXfDjwV00000NkvXXu0mjf+?Lpg literal 0 HcmV?d00001 diff --git a/website_product_brand/views/product_brand.xml b/website_product_brand/views/product_brand.xml new file mode 100644 index 0000000000..6ec589ff55 --- /dev/null +++ b/website_product_brand/views/product_brand.xml @@ -0,0 +1,64 @@ + + + + + + + + + + Shop All + /shop + + + + + Shop by Brand + /page/product_brands + + + + + \ No newline at end of file From fbccd6ab7e57bd5226ce4482ac715d0b016bf99a Mon Sep 17 00:00:00 2001 From: "Serpent Consulting Services Pvt. Ltd" Date: Wed, 25 Mar 2015 20:38:45 +0530 Subject: [PATCH 02/14] Edited changelog --- website_product_brand/ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_product_brand/ChangeLog.txt b/website_product_brand/ChangeLog.txt index 521d692234..07585c9d6c 100644 --- a/website_product_brand/ChangeLog.txt +++ b/website_product_brand/ChangeLog.txt @@ -2,5 +2,5 @@ Maintaining the changelog of the module for each commit. =================================================================== -1.0 : Vimesh Chaudhari - Serpent Consulting Services Pvt Ltd. +1.0 : Serpent Consulting Services Pvt Ltd. * Added the module. From fa3a8a2146c62e346a1fa6b8acb6f027ddb23bee Mon Sep 17 00:00:00 2001 From: "Serpent Consulting Services Pvt. Ltd" Date: Thu, 26 Mar 2015 13:11:42 +0530 Subject: [PATCH 03/14] Edited import statements --- website_product_brand/__init__.py | 2 +- website_product_brand/controllers/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website_product_brand/__init__.py b/website_product_brand/__init__.py index 1d2fc26d1f..a153ed99c5 100644 --- a/website_product_brand/__init__.py +++ b/website_product_brand/__init__.py @@ -19,6 +19,6 @@ # ############################################################################## -import controllers +from . import controllers # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/website_product_brand/controllers/__init__.py b/website_product_brand/controllers/__init__.py index f3dda2ff20..df9c0f978f 100644 --- a/website_product_brand/controllers/__init__.py +++ b/website_product_brand/controllers/__init__.py @@ -19,6 +19,6 @@ # ############################################################################## -import main +from . import main # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From b18f8064e27d7102432918ae9791b4bdfab1d8b3 Mon Sep 17 00:00:00 2001 From: "Serpent Consulting Services Pvt. Ltd" Date: Thu, 26 Mar 2015 13:36:14 +0530 Subject: [PATCH 04/14] pep-8 standard appalied...Thanks to Oscar Alca --- website_product_brand/controllers/main.py | 203 ++++++++++++++-------- 1 file changed, 134 insertions(+), 69 deletions(-) diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py index 7b39a87b19..5c5198e384 100644 --- a/website_product_brand/controllers/main.py +++ b/website_product_brand/controllers/main.py @@ -23,14 +23,12 @@ from openerp import http from openerp.http import request import openerp.addons.website_sale.controllers.main -from openerp import http, SUPERUSER_ID -import werkzeug -from openerp.tools.translate import _ +from openerp import SUPERUSER_ID from openerp.addons.website.models.website import slug -from gi.overrides.keysyms import currency PPG = 20 PPR = 4 + class table_compute(object): def __init__(self): @@ -74,33 +72,39 @@ def process(self, products): for x2 in range(x): self.table[pos / PPR + y2][pos % PPR + x2] = False - self.table[pos / PPR][pos % PPR] = {'product': p, - 'x': x, - 'y': y, - 'class': ' '.join(map(lambda x: x.html_class or '', p.website_style_ids))} + self.table[ + pos / + PPR][ + pos % + PPR] = { + 'product': p, + 'x': x, + 'y': y, + 'class': ' '.join( + map( + lambda x: x.html_class or '', + p.website_style_ids))} if index <= PPG: maxy = max(maxy, y + pos / PPR) index += 1 - rows = self.table.items() - rows.sort() + rows = sorted(self.table.items()) rows = map(lambda x: x[1], rows) for col in range(len(rows)): - cols = rows[col].items() - cols.sort() + cols = sorted(rows[col].items()) x += len(cols) - rows[col] = [ c for c in map(lambda x: x[1], cols) if c != False ] + rows[col] = [c for c in map(lambda x: x[1], cols) if c] return rows class QueryURL(object): - def __init__(self, path = '', **args): + def __init__(self, path='', **args): self.path = path self.args = args - def __call__(self, path = None, **kw): + def __call__(self, path=None, **kw): if not path: path = self.path for k, v in self.args.items(): @@ -110,7 +114,7 @@ def __call__(self, path = None, **kw): for k, v in kw.items(): if v: if isinstance(v, list) or isinstance(v, set): - l.append(werkzeug.url_encode([ (k, i) for i in v ])) + l.append(werkzeug.url_encode([(k, i) for i in v])) else: l.append(werkzeug.url_encode([(k, v)])) @@ -122,31 +126,33 @@ def __call__(self, path = None, **kw): class website_sale(openerp.addons.website_sale.controllers.main.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, search = '', **post): + '/shop/page/', + '/shop/category/', + '/shop/category//page/', + '/shop/brands'], + type='http', + auth='public', + website=True) + def shop(self, page=0, category=None, search='', **post): cr, uid, context, pool = (request.cr, - request.uid, - request.context, - request.registry) + request.uid, + request.context, + request.registry) values = {} - child_prod_id = [] domain = request.website.sale_product_domain() if search: domain += ['|', - '|', - '|', - ('name', 'ilike', search), - ('description', 'ilike', search), - ('description_sale', 'ilike', search), - ('product_variant_ids.default_code', 'ilike', search)] + '|', + '|', + ('name', 'ilike', search), + ('description', 'ilike', search), + ('description_sale', 'ilike', search), + ('product_variant_ids.default_code', 'ilike', search)] if category: domain += [('public_categ_ids', 'child_of', int(category))] 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 ]) + attrib_values = [map(int, v.split('-')) for v in attrib_list if v] + attrib_set = set([v[1] for v in attrib_values]) if attrib_values: attrib = None ids = [] @@ -163,72 +169,129 @@ def shop(self, page = 0, category = None, search = '', **post): if attrib: domain += [('attribute_line_ids.value_ids', 'in', ids)] - keep = QueryURL('/shop', category=category and int(category), search=search, attrib=attrib_list) + keep = QueryURL( + '/shop', + category=category and int(category), + search=search, + attrib=attrib_list) if not context.get('pricelist'): pricelist = self.get_pricelist() context['pricelist'] = int(pricelist) else: - pricelist = pool.get('product.pricelist').browse(cr, uid, context['pricelist'], context) + pricelist = pool.get('product.pricelist').browse( + cr, + uid, + context['pricelist'], + context) product_obj = pool.get('product.template') # Brand's product search if post.get('brand'): product_designer_obj = pool.get('product.brand') - brand_ids = product_designer_obj.search(cr, SUPERUSER_ID, [('id', '=', int(post.get('brand')))]) + brand_ids = product_designer_obj.search( + cr, SUPERUSER_ID, [ + ('id', '=', int( + post.get('brand')))]) domain = [('product_brand_id', 'in', brand_ids)] url = '/shop' - product_count = product_obj.search_count(cr, uid, domain, context=context) + product_count = product_obj.search_count( + cr, + uid, + domain, + context=context) if search: post['search'] = search if category: - category = pool['product.public.category'].browse(cr, uid, int(category), context=context) + category = pool['product.public.category'].browse( + cr, + uid, + int(category), + context=context) url = '/shop/category/%s' % slug(category) - pager = request.website.pager(url=url, total=product_count, page=page, step=PPG, scope=7, url_args=post) - product_ids = product_obj.search(cr, uid, domain, limit=PPG, offset=pager['offset'], order='website_published desc, website_sequence desc', context=context) + pager = request.website.pager( + url=url, + total=product_count, + page=page, + step=PPG, + scope=7, + url_args=post) + product_ids = product_obj.search( + cr, + uid, + domain, + limit=PPG, + offset=pager['offset'], + order='website_published desc, website_sequence desc', + context=context) products = product_obj.browse(cr, uid, product_ids, context=context) style_obj = pool['product.style'] style_ids = style_obj.search(cr, uid, [], context=context) styles = style_obj.browse(cr, uid, style_ids, context=context) category_obj = pool['product.public.category'] category_ids = category_obj.search(cr, uid, [], context=context) - categories = category_obj.browse(cr, uid, category_ids, context=context) + categories = category_obj.browse( + cr, + uid, + category_ids, + context=context) categs = filter(lambda x: not x.parent_id, categories) if category: selected_id = int(category) - child_prod_ids = category_obj.search(cr, uid, [('parent_id', '=', selected_id)], context=context) + child_prod_ids = category_obj.search( + cr, uid, [ + ('parent_id', '=', selected_id)], context=context) children_ids = category_obj.browse(cr, uid, child_prod_ids) values.update({'child_list': children_ids}) attributes_obj = request.registry['product.attribute'] attributes_ids = attributes_obj.search(cr, uid, [], context=context) - attributes = attributes_obj.browse(cr, uid, attributes_ids, context=context) - from_currency = pool.get('product.price.type')._get_field_currency(cr, uid, 'list_price', context) + attributes = attributes_obj.browse( + cr, + uid, + attributes_ids, + context=context) + from_currency = pool.get('product.price.type')._get_field_currency( + cr, + uid, + 'list_price', + context) to_currency = pricelist.currency_id - compute_currency = lambda price: pool['res.currency']._compute(cr, uid, from_currency, to_currency, price, context=context) + compute_currency = lambda price: pool['res.currency']._compute( + cr, + uid, + from_currency, + to_currency, + price, + context=context) values.update({'search': search, - 'category': category, - 'attrib_values': attrib_values, - 'attrib_set': attrib_set, - 'pager': pager, - 'pricelist': pricelist, - 'products': products, - 'bins': table_compute().process(products), - 'rows': PPR, - 'styles': styles, - 'categories': categs, - 'attributes': attributes, - 'compute_currency': compute_currency, - 'keep': keep, - 'style_in_product': lambda style, product: style.id in [ s.id for s in product.website_style_ids ], - 'attrib_encode': lambda attribs: werkzeug.url_encode([ ('attrib', i) for i in attribs ])}) + 'category': category, + 'attrib_values': attrib_values, + 'attrib_set': attrib_set, + 'pager': pager, + 'pricelist': pricelist, + 'products': products, + 'bins': table_compute().process(products), + 'rows': PPR, + 'styles': styles, + 'categories': categs, + 'attributes': attributes, + 'compute_currency': compute_currency, + 'keep': keep, + 'style_in_product': lambda style, + product: style.id in [s.id for s in product.website_style_ids], + 'attrib_encode': lambda attribs: werkzeug.url_encode([('attrib', + i) for i in attribs])}) return request.website.render('website_sale.products', values) - #Method to get the brands. - @http.route(['/page/product_brands'], type='http', auth='public', website=True) + # Method to get the brands. + @http.route( + ['/page/product_brands'], + type='http', + auth='public', + website=True) def product_brands(self, **post): - cr, uid, context, pool = (request.cr, - request.uid, - request.context, - request.registry) + cr, context, pool = (request.cr, + request.context, + request.registry) brand_values = [] brand_obj = pool['product.brand'] domain = [] @@ -240,9 +303,11 @@ def product_brands(self, **post): keep = QueryURL('/page/product_brands', brand_id=[]) values = {'brand_rec': brand_values, - 'keep': keep} + 'keep': keep} if post.get('search'): values.update({'search': post.get('search')}) - return request.website.render('website_product_brand.product_brands', values) + return request.website.render( + 'website_product_brand.product_brands', + values) -# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From d490b5f36075bd59c02daefcf0ba02f818dc239c Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Mon, 18 May 2015 17:40:30 +0530 Subject: [PATCH 05/14] [ADD/IMP] Added filter and domain based on the brand and improved code. --- website_product_brand/__init__.py | 5 +- website_product_brand/__openerp__.py | 18 +-- website_product_brand/controllers/__init__.py | 5 +- website_product_brand/controllers/main.py | 111 ++---------------- .../static/description/icon.png | Bin 16349 -> 0 bytes website_product_brand/views/product_brand.xml | 12 +- 6 files changed, 35 insertions(+), 116 deletions(-) delete mode 100644 website_product_brand/static/description/icon.png diff --git a/website_product_brand/__init__.py b/website_product_brand/__init__.py index a153ed99c5..1c5bb904de 100644 --- a/website_product_brand/__init__.py +++ b/website_product_brand/__init__.py @@ -2,7 +2,8 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# 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 @@ -20,5 +21,3 @@ ############################################################################## from . import controllers - -# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/website_product_brand/__openerp__.py b/website_product_brand/__openerp__.py index a529c11b11..a4d4f857c9 100644 --- a/website_product_brand/__openerp__.py +++ b/website_product_brand/__openerp__.py @@ -2,7 +2,8 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# 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 @@ -27,10 +28,15 @@ 'summary': '', 'version': '1.0', 'description': """ -Allows to use product brands as filtering for products in website.\n -This Module depends on product_brand module -https://github.com/OCA/product-attribute/tree/8.0/product_brand\n -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 +Product Brand Filtering in Website +================================== +Allows to use product brands as filtering for products in website. +This Module depends on product_brand module : +->https://github.com/OCA/product-attribute/tree/8.0/product_brand +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 """, 'depends': ['product_brand','website_sale'], @@ -41,5 +47,3 @@ 'installable': True, 'auto_install': False, } - -# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/website_product_brand/controllers/__init__.py b/website_product_brand/controllers/__init__.py index df9c0f978f..ebd700982e 100644 --- a/website_product_brand/controllers/__init__.py +++ b/website_product_brand/controllers/__init__.py @@ -2,7 +2,8 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# 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 @@ -20,5 +21,3 @@ ############################################################################## from . import main - -# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py index 5c5198e384..2cb8a139c6 100644 --- a/website_product_brand/controllers/main.py +++ b/website_product_brand/controllers/main.py @@ -2,7 +2,8 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# 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 @@ -25,104 +26,12 @@ import openerp.addons.website_sale.controllers.main from openerp import SUPERUSER_ID from openerp.addons.website.models.website import slug +from openerp.addons.website_sale.controllers.main import table_compute,QueryURL + PPG = 20 PPR = 4 -class table_compute(object): - - def __init__(self): - self.table = {} - - def _check_place(self, posx, posy, sizex, sizey): - res = True - for y in range(sizey): - for x in range(sizex): - if posx + x >= PPR: - res = False - break - row = self.table.setdefault(posy + y, {}) - if row.setdefault(posx + x) is not None: - res = False - break - - for x in range(PPR): - self.table[posy + y].setdefault(x, None) - - return res - - def process(self, products): - minpos = 0 - index = 0 - maxy = 0 - for p in products: - x = min(max(p.website_size_x, 1), PPR) - y = min(max(p.website_size_y, 1), PPR) - if index > PPG: - x = y = 1 - pos = minpos - while not self._check_place(pos % PPR, pos / PPR, x, y): - pos += 1 - - if index > PPG and pos / PPR > maxy: - break - if x == 1 and y == 1: - minpos = pos / PPR - for y2 in range(y): - for x2 in range(x): - self.table[pos / PPR + y2][pos % PPR + x2] = False - - self.table[ - pos / - PPR][ - pos % - PPR] = { - 'product': p, - 'x': x, - 'y': y, - 'class': ' '.join( - map( - lambda x: x.html_class or '', - p.website_style_ids))} - if index <= PPG: - maxy = max(maxy, y + pos / PPR) - index += 1 - - rows = sorted(self.table.items()) - rows = map(lambda x: x[1], rows) - for col in range(len(rows)): - cols = sorted(rows[col].items()) - x += len(cols) - rows[col] = [c for c in map(lambda x: x[1], cols) if c] - - return rows - - -class QueryURL(object): - - def __init__(self, path='', **args): - self.path = path - self.args = args - - def __call__(self, path=None, **kw): - if not path: - path = self.path - for k, v in self.args.items(): - kw.setdefault(k, v) - - l = [] - for k, v in kw.items(): - if v: - if isinstance(v, list) or isinstance(v, set): - l.append(werkzeug.url_encode([(k, i) for i in v])) - else: - l.append(werkzeug.url_encode([(k, v)])) - - if l: - path += '?' + '&'.join(l) - return path - - class website_sale(openerp.addons.website_sale.controllers.main.website_sale): @http.route(['/shop', @@ -133,7 +42,7 @@ class website_sale(openerp.addons.website_sale.controllers.main.website_sale): type='http', auth='public', website=True) - def shop(self, page=0, category=None, search='', **post): + def shop(self, page=0, category=None, brand=None, search='', **post): cr, uid, context, pool = (request.cr, request.uid, request.context, @@ -186,13 +95,13 @@ def shop(self, page=0, category=None, search='', **post): product_obj = pool.get('product.template') # Brand's product search - if post.get('brand'): + if brand: + values.update({'brand': brand}) product_designer_obj = pool.get('product.brand') brand_ids = product_designer_obj.search( cr, SUPERUSER_ID, [ - ('id', '=', int( - post.get('brand')))]) - domain = [('product_brand_id', 'in', brand_ids)] + ('id', '=', int(brand))]) + domain += [('product_brand_id', 'in', brand_ids)] url = '/shop' product_count = product_obj.search_count( cr, @@ -309,5 +218,3 @@ def product_brands(self, **post): return request.website.render( 'website_product_brand.product_brands', values) - -# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/website_product_brand/static/description/icon.png b/website_product_brand/static/description/icon.png deleted file mode 100644 index 53dd30d963540cd1eee217c8db5ee89277fab319..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16349 zcmV<3KO(@1P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*c0 z4hJzIq*c=Z03ZNKL_t(|+U&h~n59=$@BdkA@Ap*ooPkIN5HCq*gfJwKDEc!AgQ6m$ zR$nK6ipV55T<^V3S2=aAB3HdXCmuxfI-oe*u17)Sf=D0%FJx8((;1mU1|($avFf~g zul4(5@AuTH4w9zRojO&0-aO|?b#--Bo&A2_HGJ1v-zDzOv3>~%fI~S98L0R-s>>xA zKztxBeaCST5ieiq0^$NV{s=!n#=k}ws0+Z@_v~(jl;5R%|A9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a/website_product_brand/views/product_brand.xml b/website_product_brand/views/product_brand.xml index 6ec589ff55..e25c1ac9ff 100644 --- a/website_product_brand/views/product_brand.xml +++ b/website_product_brand/views/product_brand.xml @@ -47,13 +47,23 @@ + + Shop All /shop - + Shop by Brand /page/product_brands From 9df3adac09cb633d3bf49bc8b46971e8ec160e08 Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Thu, 20 Aug 2015 14:47:18 +0530 Subject: [PATCH 06/14] [IMP] Improved the code as per requirement. --- website_product_brand/ChangeLog.txt | 6 -- website_product_brand/README.rst | 65 ++++++++++++++++++ website_product_brand/__openerp__.py | 12 ++-- website_product_brand/controllers/main.py | 27 ++++---- .../static/description/icon.png | Bin 0 -> 9455 bytes 5 files changed, 88 insertions(+), 22 deletions(-) delete mode 100644 website_product_brand/ChangeLog.txt create mode 100644 website_product_brand/README.rst create mode 100644 website_product_brand/static/description/icon.png diff --git a/website_product_brand/ChangeLog.txt b/website_product_brand/ChangeLog.txt deleted file mode 100644 index 07585c9d6c..0000000000 --- a/website_product_brand/ChangeLog.txt +++ /dev/null @@ -1,6 +0,0 @@ -=================================================================== -Maintaining the changelog of the module for each commit. -=================================================================== - -1.0 : Serpent Consulting Services Pvt Ltd. - * Added the module. diff --git a/website_product_brand/README.rst b/website_product_brand/README.rst new file mode 100644 index 0000000000..4c852806b6 --- /dev/null +++ b/website_product_brand/README.rst @@ -0,0 +1,65 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Website 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 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_product_brand/__openerp__.py b/website_product_brand/__openerp__.py index a4d4f857c9..c70d4cbbc2 100644 --- a/website_product_brand/__openerp__.py +++ b/website_product_brand/__openerp__.py @@ -22,9 +22,10 @@ { 'name': 'Product Brand Filtering in Website', - 'category': 'Website', - 'author': 'Serpent Consulting Services Pvt Ltd', - 'website':'http://www.serpentcs.com', + 'category': 'e-commerce', + 'author': """Serpent Consulting Services Pvt. Ltd., + Odoo Community Association (OCA)""", + 'website': 'http://www.serpentcs.com', 'summary': '', 'version': '1.0', 'description': """ @@ -39,7 +40,10 @@ https://www.youtube.com/watch?feature=player_embedded&v=LkV5umivylw """, - 'depends': ['product_brand','website_sale'], + 'depends': [ + 'product_brand', + 'website_sale' + ], 'data': [ "security/ir.model.access.csv", "views/product_brand.xml", diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py index 2cb8a139c6..d13fb527d5 100644 --- a/website_product_brand/controllers/main.py +++ b/website_product_brand/controllers/main.py @@ -26,18 +26,19 @@ import openerp.addons.website_sale.controllers.main from openerp import SUPERUSER_ID from openerp.addons.website.models.website import slug -from openerp.addons.website_sale.controllers.main import table_compute,QueryURL - +from openerp.addons.website_sale.controllers.main import table_compute +from openerp.addons.website_sale.controllers.main import QueryURL PPG = 20 PPR = 4 -class website_sale(openerp.addons.website_sale.controllers.main.website_sale): +class WebsiteSale(openerp.addons.website_sale.controllers.main.website_sale): @http.route(['/shop', '/shop/page/', '/shop/category/', - '/shop/category//page/', + """/shop/category/ + /page/""", '/shop/brands'], type='http', auth='public', @@ -171,6 +172,10 @@ def shop(self, page=0, category=None, brand=None, search='', **post): to_currency, price, context=context) + style_in_product = lambda style, product: style.id in [ + s.id for s in product.website_style_ids] + attrib_encode = lambda attribs: werkzeug.url_encode( + [('attrib', i) for i in attribs]) values.update({'search': search, 'category': category, 'attrib_values': attrib_values, @@ -185,10 +190,8 @@ def shop(self, page=0, category=None, brand=None, search='', **post): 'attributes': attributes, 'compute_currency': compute_currency, 'keep': keep, - 'style_in_product': lambda style, - product: style.id in [s.id for s in product.website_style_ids], - 'attrib_encode': lambda attribs: werkzeug.url_encode([('attrib', - i) for i in attribs])}) + 'style_in_product': style_in_product, + 'attrib_encode': attrib_encode}) return request.website.render('website_sale.products', values) # Method to get the brands. @@ -202,13 +205,13 @@ def product_brands(self, **post): request.context, request.registry) brand_values = [] - brand_obj = pool['product.brand'] + b_obj = pool['product.brand'] domain = [] if post.get('search'): domain += [('name', 'ilike', post.get('search'))] - brand_ids = brand_obj.search(cr, SUPERUSER_ID, domain) - for brand_rec in brand_obj.browse(cr, SUPERUSER_ID, brand_ids, context=context): - brand_values.append(brand_rec) + brand_ids = b_obj.search(cr, SUPERUSER_ID, domain) + for rec in b_obj.browse(cr, SUPERUSER_ID, brand_ids, context=context): + brand_values.append(rec) keep = QueryURL('/page/product_brands', brand_id=[]) values = {'brand_rec': brand_values, diff --git a/website_product_brand/static/description/icon.png b/website_product_brand/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65q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|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From 58eb8d3263ee75921ca9562973161b971da344c7 Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Thu, 20 Aug 2015 15:03:37 +0530 Subject: [PATCH 07/14] [ADD]Added external depedent module's path in travis file. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 99b9650dec..659e4496f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,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 From 695dacabe20d90f5ed9188badf470d5218bdb11c Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Thu, 20 Aug 2015 15:50:19 +0530 Subject: [PATCH 08/14] [IMP/REM]Removed description from openerp file and changed the import path. --- website_product_brand/__openerp__.py | 12 ------------ website_product_brand/controllers/main.py | 5 ++--- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/website_product_brand/__openerp__.py b/website_product_brand/__openerp__.py index c70d4cbbc2..f0a83866bc 100644 --- a/website_product_brand/__openerp__.py +++ b/website_product_brand/__openerp__.py @@ -28,18 +28,6 @@ 'website': 'http://www.serpentcs.com', 'summary': '', 'version': '1.0', - 'description': """ -Product Brand Filtering in Website -================================== -Allows to use product brands as filtering for products in website. -This Module depends on product_brand module : -->https://github.com/OCA/product-attribute/tree/8.0/product_brand -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 - - """, 'depends': [ 'product_brand', 'website_sale' diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py index d13fb527d5..fd859d5ad9 100644 --- a/website_product_brand/controllers/main.py +++ b/website_product_brand/controllers/main.py @@ -23,16 +23,15 @@ import werkzeug from openerp import http from openerp.http import request -import openerp.addons.website_sale.controllers.main from openerp import SUPERUSER_ID from openerp.addons.website.models.website import slug from openerp.addons.website_sale.controllers.main import table_compute -from openerp.addons.website_sale.controllers.main import QueryURL +from openerp.addons.website_sale.controllers.main import QueryURL,website_sale PPG = 20 PPR = 4 -class WebsiteSale(openerp.addons.website_sale.controllers.main.website_sale): +class WebsiteSale(website_sale): @http.route(['/shop', '/shop/page/', From 5067190ce99befcb0272c48cca1add3c945b1f3b Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Thu, 20 Aug 2015 18:01:39 +0530 Subject: [PATCH 09/14] [IMP/ADD]Improved code of shop method and removed unnecessary code. --- website_product_brand/__init__.py | 1 + website_product_brand/controllers/main.py | 165 ++-------------------- website_product_brand/models/__init__.py | 23 +++ website_product_brand/models/website.py | 36 +++++ 4 files changed, 68 insertions(+), 157 deletions(-) create mode 100644 website_product_brand/models/__init__.py create mode 100644 website_product_brand/models/website.py diff --git a/website_product_brand/__init__.py b/website_product_brand/__init__.py index 1c5bb904de..29c3ac599b 100644 --- a/website_product_brand/__init__.py +++ b/website_product_brand/__init__.py @@ -21,3 +21,4 @@ ############################################################################## from . import controllers +from . import models diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py index fd859d5ad9..16cc854ee2 100644 --- a/website_product_brand/controllers/main.py +++ b/website_product_brand/controllers/main.py @@ -20,15 +20,10 @@ # ############################################################################## -import werkzeug from openerp import http from openerp.http import request from openerp import SUPERUSER_ID -from openerp.addons.website.models.website import slug -from openerp.addons.website_sale.controllers.main import table_compute from openerp.addons.website_sale.controllers.main import QueryURL,website_sale -PPG = 20 -PPR = 4 class WebsiteSale(website_sale): @@ -43,155 +38,13 @@ class WebsiteSale(website_sale): auth='public', website=True) def shop(self, page=0, category=None, brand=None, search='', **post): - cr, uid, context, pool = (request.cr, - request.uid, - request.context, - request.registry) - values = {} - domain = request.website.sale_product_domain() - if search: - domain += ['|', - '|', - '|', - ('name', 'ilike', search), - ('description', 'ilike', search), - ('description_sale', 'ilike', search), - ('product_variant_ids.default_code', 'ilike', search)] - if category: - domain += [('public_categ_ids', 'child_of', int(category))] - 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]) - if attrib_values: - attrib = None - ids = [] - for value in attrib_values: - if not attrib: - attrib = value[0] - ids.append(value[1]) - elif value[0] == attrib: - ids.append(value[1]) - else: - domain += [('attribute_line_ids.value_ids', 'in', ids)] - attrib = value[0] - ids = [value[1]] - - if attrib: - domain += [('attribute_line_ids.value_ids', 'in', ids)] - keep = QueryURL( - '/shop', - category=category and int(category), - search=search, - attrib=attrib_list) - if not context.get('pricelist'): - pricelist = self.get_pricelist() - context['pricelist'] = int(pricelist) - else: - pricelist = pool.get('product.pricelist').browse( - cr, - uid, - context['pricelist'], - context) - product_obj = pool.get('product.template') - - # Brand's product search if brand: - values.update({'brand': brand}) - product_designer_obj = pool.get('product.brand') - brand_ids = product_designer_obj.search( - cr, SUPERUSER_ID, [ - ('id', '=', int(brand))]) - domain += [('product_brand_id', 'in', brand_ids)] - url = '/shop' - product_count = product_obj.search_count( - cr, - uid, - domain, - context=context) - if search: - post['search'] = search - if category: - category = pool['product.public.category'].browse( - cr, - uid, - int(category), - context=context) - url = '/shop/category/%s' % slug(category) - pager = request.website.pager( - url=url, - total=product_count, - page=page, - step=PPG, - scope=7, - url_args=post) - product_ids = product_obj.search( - cr, - uid, - domain, - limit=PPG, - offset=pager['offset'], - order='website_published desc, website_sequence desc', - context=context) - products = product_obj.browse(cr, uid, product_ids, context=context) - style_obj = pool['product.style'] - style_ids = style_obj.search(cr, uid, [], context=context) - styles = style_obj.browse(cr, uid, style_ids, context=context) - category_obj = pool['product.public.category'] - category_ids = category_obj.search(cr, uid, [], context=context) - categories = category_obj.browse( - cr, - uid, - category_ids, - context=context) - categs = filter(lambda x: not x.parent_id, categories) - if category: - selected_id = int(category) - child_prod_ids = category_obj.search( - cr, uid, [ - ('parent_id', '=', selected_id)], context=context) - children_ids = category_obj.browse(cr, uid, child_prod_ids) - values.update({'child_list': children_ids}) - attributes_obj = request.registry['product.attribute'] - attributes_ids = attributes_obj.search(cr, uid, [], context=context) - attributes = attributes_obj.browse( - cr, - uid, - attributes_ids, - context=context) - from_currency = pool.get('product.price.type')._get_field_currency( - cr, - uid, - 'list_price', - context) - to_currency = pricelist.currency_id - compute_currency = lambda price: pool['res.currency']._compute( - cr, - uid, - from_currency, - to_currency, - price, - context=context) - style_in_product = lambda style, product: style.id in [ - s.id for s in product.website_style_ids] - attrib_encode = lambda attribs: werkzeug.url_encode( - [('attrib', i) for i in attribs]) - values.update({'search': search, - 'category': category, - 'attrib_values': attrib_values, - 'attrib_set': attrib_set, - 'pager': pager, - 'pricelist': pricelist, - 'products': products, - 'bins': table_compute().process(products), - 'rows': PPR, - 'styles': styles, - 'categories': categs, - 'attributes': attributes, - 'compute_currency': compute_currency, - 'keep': keep, - 'style_in_product': style_in_product, - 'attrib_encode': attrib_encode}) - return request.website.render('website_sale.products', values) + 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( @@ -203,17 +56,15 @@ def product_brands(self, **post): cr, context, pool = (request.cr, request.context, request.registry) - brand_values = [] 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) - for rec in b_obj.browse(cr, SUPERUSER_ID, brand_ids, context=context): - brand_values.append(rec) + brand_rec = b_obj.browse(cr, SUPERUSER_ID, brand_ids, context=context) keep = QueryURL('/page/product_brands', brand_id=[]) - values = {'brand_rec': brand_values, + values = {'brand_rec': brand_rec, 'keep': keep} if post.get('search'): values.update({'search': post.get('search')}) diff --git a/website_product_brand/models/__init__.py b/website_product_brand/models/__init__.py new file mode 100644 index 0000000000..705ebfad63 --- /dev/null +++ b/website_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_product_brand/models/website.py b/website_product_brand/models/website.py new file mode 100644 index 0000000000..43b73f73da --- /dev/null +++ b/website_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 import api +from openerp.osv import orm +from openerp.addons.web.http import request + +class website(orm.Model): + _inherit = 'website' + + @api.multi + def sale_product_domain(self): + domain = super(website, self).sale_product_domain() + if 'brand_id' in request.env.context: + domain.append( + ('product_brand_id', '=', request.env.context['brand_id'])) + return domain From 8d16e2ef2a5c6fca32545c766939d679175491a9 Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Thu, 20 Aug 2015 18:59:16 +0530 Subject: [PATCH 10/14] [IMP]Improved the method and class name. --- website_product_brand/controllers/main.py | 9 +++++---- website_product_brand/models/website.py | 11 +++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py index 16cc854ee2..90cf1e5fa0 100644 --- a/website_product_brand/controllers/main.py +++ b/website_product_brand/controllers/main.py @@ -23,7 +23,8 @@ from openerp import http from openerp.http import request from openerp import SUPERUSER_ID -from openerp.addons.website_sale.controllers.main import QueryURL,website_sale +from openerp.addons.website_sale.controllers.main import QueryURL +from openerp.addons.website_sale.controllers.main import website_sale class WebsiteSale(website_sale): @@ -40,9 +41,9 @@ class WebsiteSale(website_sale): 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 = super(WebsiteSale, self).shop(page=page, category=category, + brand=brand,search=search, + **post) result.qcontext['brand'] = brand return result diff --git a/website_product_brand/models/website.py b/website_product_brand/models/website.py index 43b73f73da..31b86f3c0d 100644 --- a/website_product_brand/models/website.py +++ b/website_product_brand/models/website.py @@ -20,16 +20,15 @@ # ############################################################################## -from openerp import api from openerp.osv import orm -from openerp.addons.web.http import request +from openerp.http import request -class website(orm.Model): + +class WebSite(orm.Model): _inherit = 'website' - @api.multi - def sale_product_domain(self): - domain = super(website, self).sale_product_domain() + 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'])) From 03b7282f2c00cb56d9fe7387fe84a884dce8cbbf Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Thu, 20 Aug 2015 19:03:15 +0530 Subject: [PATCH 11/14] [IMP]Added whitespace. --- website_product_brand/controllers/main.py | 2 +- website_product_brand/models/website.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/website_product_brand/controllers/main.py b/website_product_brand/controllers/main.py index 90cf1e5fa0..13287d86cf 100644 --- a/website_product_brand/controllers/main.py +++ b/website_product_brand/controllers/main.py @@ -42,7 +42,7 @@ 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, + brand=brand, search=search, **post) result.qcontext['brand'] = brand return result diff --git a/website_product_brand/models/website.py b/website_product_brand/models/website.py index 31b86f3c0d..0f0902015c 100644 --- a/website_product_brand/models/website.py +++ b/website_product_brand/models/website.py @@ -28,7 +28,8 @@ 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) + 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'])) From eb955414cd00a670967eb4942ea6b46c6babf985 Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Fri, 21 Aug 2015 10:27:10 +0530 Subject: [PATCH 12/14] [FIX]Fixed .travis.yml --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 659e4496f4..4c028c2eef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,9 @@ +addons: + apt: + sources: + - pov-wkhtmltopdf + packages: + - wkhtmltopdf language: python python: - "2.7" @@ -10,6 +16,10 @@ env: virtualenv: system_site_packages: true +before_install: + - "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 - export PATH=$HOME/maintainer-quality-tools/travis:$PATH From 1fa2cb0530bd018e39fdc039dd3fdb1199f943a7 Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Thu, 27 Aug 2015 11:20:01 +0530 Subject: [PATCH 13/14] [IMP]Improved redme and openerp file. --- website_product_brand/README.rst | 7 ++++--- website_product_brand/__openerp__.py | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/website_product_brand/README.rst b/website_product_brand/README.rst index 4c852806b6..ae9a9ecfff 100644 --- a/website_product_brand/README.rst +++ b/website_product_brand/README.rst @@ -1,11 +1,12 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 +===================== Website 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. @@ -19,7 +20,7 @@ extent and by providing basic search by brands, thus reducing end-user’s effor searching the products he/she wants to purchase. Usage ------------- +===== To use this module, you need to: diff --git a/website_product_brand/__openerp__.py b/website_product_brand/__openerp__.py index f0a83866bc..24a37a5143 100644 --- a/website_product_brand/__openerp__.py +++ b/website_product_brand/__openerp__.py @@ -23,11 +23,10 @@ { 'name': 'Product Brand Filtering in Website', 'category': 'e-commerce', - 'author': """Serpent Consulting Services Pvt. Ltd., - Odoo Community Association (OCA)""", + 'author': "Serpent Consulting Services Pvt. Ltd," + "Odoo Community Association (OCA)", 'website': 'http://www.serpentcs.com', - 'summary': '', - 'version': '1.0', + 'version': '8.0.1.0.0', 'depends': [ 'product_brand', 'website_sale' From 65edc0a7502e5c91a8abd1c45e72a79829dd98e5 Mon Sep 17 00:00:00 2001 From: MeetSCS Date: Fri, 11 Sep 2015 12:54:07 +0530 Subject: [PATCH 14/14] [IMP]Changed name of module. --- .../README.rst | 8 ++++---- .../__init__.py | 0 .../__openerp__.py | 0 .../controllers/__init__.py | 0 .../controllers/main.py | 2 +- .../models/__init__.py | 0 .../models/website.py | 0 .../security/ir.model.access.csv | 0 .../static/description/icon.png | Bin .../views/product_brand.xml | 0 10 files changed, 5 insertions(+), 5 deletions(-) rename {website_product_brand => website_sale_product_brand}/README.rst (91%) rename {website_product_brand => website_sale_product_brand}/__init__.py (100%) rename {website_product_brand => website_sale_product_brand}/__openerp__.py (100%) rename {website_product_brand => website_sale_product_brand}/controllers/__init__.py (100%) rename {website_product_brand => website_sale_product_brand}/controllers/main.py (98%) rename {website_product_brand => website_sale_product_brand}/models/__init__.py (100%) rename {website_product_brand => website_sale_product_brand}/models/website.py (100%) rename {website_product_brand => website_sale_product_brand}/security/ir.model.access.csv (100%) rename {website_product_brand => website_sale_product_brand}/static/description/icon.png (100%) rename {website_product_brand => website_sale_product_brand}/views/product_brand.xml (100%) diff --git a/website_product_brand/README.rst b/website_sale_product_brand/README.rst similarity index 91% rename from website_product_brand/README.rst rename to website_sale_product_brand/README.rst index ae9a9ecfff..b023615f4a 100644 --- a/website_product_brand/README.rst +++ b/website_sale_product_brand/README.rst @@ -1,9 +1,9 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 -===================== -Website Product Brand -===================== +========================== +Website Sale Product Brand +========================== Description =========== @@ -15,7 +15,7 @@ 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 Product Brand fills the gap at certain +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. diff --git a/website_product_brand/__init__.py b/website_sale_product_brand/__init__.py similarity index 100% rename from website_product_brand/__init__.py rename to website_sale_product_brand/__init__.py diff --git a/website_product_brand/__openerp__.py b/website_sale_product_brand/__openerp__.py similarity index 100% rename from website_product_brand/__openerp__.py rename to website_sale_product_brand/__openerp__.py diff --git a/website_product_brand/controllers/__init__.py b/website_sale_product_brand/controllers/__init__.py similarity index 100% rename from website_product_brand/controllers/__init__.py rename to website_sale_product_brand/controllers/__init__.py diff --git a/website_product_brand/controllers/main.py b/website_sale_product_brand/controllers/main.py similarity index 98% rename from website_product_brand/controllers/main.py rename to website_sale_product_brand/controllers/main.py index 9b39adc58d..d5e5cfdb8a 100644 --- a/website_product_brand/controllers/main.py +++ b/website_sale_product_brand/controllers/main.py @@ -71,7 +71,7 @@ def product_brands(self, **post): if post.get('search'): values.update({'search': post.get('search')}) return request.website.render( - 'website_product_brand.product_brands', + 'website_sale_product_brand.product_brands', values) openerp.addons.website_sale.controllers.main.website_sale = WebsiteSale diff --git a/website_product_brand/models/__init__.py b/website_sale_product_brand/models/__init__.py similarity index 100% rename from website_product_brand/models/__init__.py rename to website_sale_product_brand/models/__init__.py diff --git a/website_product_brand/models/website.py b/website_sale_product_brand/models/website.py similarity index 100% rename from website_product_brand/models/website.py rename to website_sale_product_brand/models/website.py diff --git a/website_product_brand/security/ir.model.access.csv b/website_sale_product_brand/security/ir.model.access.csv similarity index 100% rename from website_product_brand/security/ir.model.access.csv rename to website_sale_product_brand/security/ir.model.access.csv diff --git a/website_product_brand/static/description/icon.png b/website_sale_product_brand/static/description/icon.png similarity index 100% rename from website_product_brand/static/description/icon.png rename to website_sale_product_brand/static/description/icon.png diff --git a/website_product_brand/views/product_brand.xml b/website_sale_product_brand/views/product_brand.xml similarity index 100% rename from website_product_brand/views/product_brand.xml rename to website_sale_product_brand/views/product_brand.xml