Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG]Migrated shop_by_brand module in v9. #103

Merged
merged 10 commits into from
Apr 11, 2016
40 changes: 29 additions & 11 deletions website_sale_product_brand/README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==========================
Website Sale Product Brand
Expand All @@ -11,14 +12,17 @@ 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
extent and by providing basic search by brands, thus reducing end-user’s efforts in
searching the products he/she wants to purchase.

Installation
============

To install this module, you need to install following module:
->https://github.com/OCA/product-attribute/tree/9.0/product_brand

Usage
=====

Expand All @@ -33,21 +37,35 @@ Based on this configuration, you will see the menuitem shop by brand under shop
It will show all the brands and once you select that brand it will show product's which
is related to this brand.

The blog here explains the HOWTO :

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember a comment about it: should not we rather have the content of the blog in here? (Or at least a summary)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please put here the content of the blog post. We want all the documentation auto-contained.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedrobaeza @elicoidal I will update readme with blog content.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedrobaeza @elicoidal Actually summary of is already added in the description part of the readme file.

By going through the blog, I think we can add road map in readme file ?

What are your suggestions ?

Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you make a summary of the post blog in the Usage section?

Copy link
Sponsor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedrobaeza @elicoidal Changed the usage section.

http://www.serpentcs.com/serpentcs-odoo-ecommerce-shop-brands-contribution
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to copy the blog content here in the section Usage

The Youtube Video is here :
https://www.youtube.com/watch?feature=player_embedded&v=LkV5umivylw

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/113/50

The blog here explains the HOWTO :

http://www.serpentcs.com/serpentcs-odoo-ecommerce-shop-brands-contribution

The Youtube Video is here :
Bug Tracker
===========

https://www.youtube.com/watch?feature=player_embedded&v=LkV5umivylw
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/e-commerce/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
e-commerce/issues/new?body=module:%20
website_sale_product_brand%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

below please replace https (x3)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elicoidal I did not get it, Can you please explain ?

Thanks.

Expand Down
22 changes: 2 additions & 20 deletions website_sale_product_brand/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
#
# 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 <http://www.gnu.org/licenses/>
#
##############################################################################
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import controllers
from . import models
28 changes: 6 additions & 22 deletions website_sale_product_brand/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
#
# 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 <http://www.gnu.org/licenses/>
#
##############################################################################
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'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',
'version': '9.0.1.0.0',
'license': 'AGPL-3',
'depends': [
'product_brand',
'website_sale'
Expand All @@ -35,6 +18,7 @@
"security/ir.model.access.csv",
"views/product_brand.xml",
],
'installable': False,
'application': False,
'installable': True,
'auto_install': False,
}
22 changes: 2 additions & 20 deletions website_sale_product_brand/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
#
# 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 <http://www.gnu.org/licenses/>
#
##############################################################################
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import main
30 changes: 5 additions & 25 deletions website_sale_product_brand/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
#
# 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 <http://www.gnu.org/licenses/>
#
##############################################################################
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import openerp
from openerp import http
Expand All @@ -42,11 +24,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.qcontext['brand'] = brand
return result
return super(WebsiteSale, self).shop(page=page, category=category,
brand=brand, search=search,
**post)

# Method to get the brands.
@http.route(
Expand Down
22 changes: 2 additions & 20 deletions website_sale_product_brand/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
#
# 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 <http://www.gnu.org/licenses/>
#
##############################################################################
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import website
30 changes: 6 additions & 24 deletions website_sale_product_brand/models/website.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
#
# 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 <http://www.gnu.org/licenses/>
#
##############################################################################
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp.osv import orm
from openerp import models
from openerp.http import request


class WebSite(orm.Model):
class WebSite(models.Model):
_inherit = 'website'

def sale_product_domain(self, cr, uid, ids, context=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this in new API (with @api.multi signature)

domain = super(WebSite, self).sale_product_domain(cr, uid, ids=ids,
context=context)
if 'brand_id' in request.env.context:
if 'brand_id' in request.context:
domain.append(
('product_brand_id', '=', request.env.context['brand_id']))
('product_brand_id', '=', request.context['brand_id']))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you are inside a model, you should use self.env.context. request.context is mainly for controllers.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yajo Thanks for the review, I will update the code soon.

return domain