-
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
77 changed files
with
3,459 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/website_sale_product_brand/odoo/addons/website_sale_product_brand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../website_sale_product_brand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
================================== | ||
Product Brand Filtering in Website | ||
================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github | ||
:target: https://github.com/OCA/e-commerce/tree/15.0/website_sale_product_brand | ||
:alt: OCA/e-commerce | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_product_brand | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/113/15.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module was written to extend the functionality of product filtering on website. | ||
It will allow you to filter product based on its 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. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
In order to hide brands from the e-commerce: | ||
|
||
#. Go to *Website > Settings > Products > Product brands* | ||
#. Click on the brand you want to unpublish. | ||
#. Click on the *Website published* smart button. | ||
|
||
Usage | ||
===== | ||
|
||
Shop by brand feature is available on various famous e-commerce websites like amazon, | ||
flipkart and many. Shop by brand feature enables you to display product relevant to | ||
that particular brand. | ||
|
||
To use this module, you need to: | ||
|
||
Once you install this module, user will be able to create a new brand and define the | ||
brand to a product. | ||
|
||
To create product brand go to *Website > Settings > Products > Product brands*: | ||
|
||
- User can assign a nice logo with brand description. | ||
- After configuring the brand, user can assign a particular brand to a particular | ||
products. | ||
|
||
Based on this configuration, you will see the menuitem shop by brand next to 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. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
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:%20website_sale_product_brand%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Serpent Consulting Services Pvt. Ltd. | ||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Jay Vora <jay.vora@serpentcs.com> | ||
* Meet Dholakia <m.dholakia.serpentcs@gmail.com> | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Ernesto Tejeda <ernesto.tejeda@tecnativa.com> | ||
* Sergio Teruel <sergio.teruel@tecnativa.com> | ||
* Alexandre Díaz | ||
* David Vidal | ||
* `Studio73 <https://www.studio73.es>`_: | ||
|
||
* Miguel Gandia <miguel@studio73.es> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/15.0/website_sale_product_brand>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# © 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., " | ||
"Tecnativa, " | ||
"Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/e-commerce", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"depends": ["product_brand", "website_sale"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"data/website_menu.xml", | ||
"views/product_brand.xml", | ||
"views/product_brand_views.xml", | ||
], | ||
"demo": [ | ||
"demo/product_brand_demo.xml", | ||
"demo/product_product_demo.xml", | ||
], | ||
"assets": { | ||
"web.assets_frontend": [ | ||
"/website_sale_product_brand/static/src/scss/website_sale_product_brand.scss" | ||
], | ||
"web.assets_tests": [ | ||
"/website_sale_product_brand/static/src/js/tour.js", | ||
], | ||
}, | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# © 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import http | ||
from odoo.http import request | ||
from odoo.osv import expression | ||
|
||
from odoo.addons.website_sale.controllers.main import QueryURL, WebsiteSale | ||
|
||
|
||
class WebsiteSale(WebsiteSale): | ||
def _get_search_options( | ||
self, | ||
category=None, | ||
attrib_values=None, | ||
pricelist=None, | ||
min_price=0.0, | ||
max_price=0.0, | ||
conversion_rate=1, | ||
**post | ||
): | ||
res = super()._get_search_options( | ||
category=category, | ||
attrib_values=attrib_values, | ||
pricelist=pricelist, | ||
min_price=min_price, | ||
max_price=max_price, | ||
conversion_rate=conversion_rate, | ||
**post | ||
) | ||
res["brand"] = request.context.get("brand_id") | ||
return res | ||
|
||
def _get_search_domain( | ||
self, search, category, attrib_values, search_in_description=True | ||
): | ||
domain = super()._get_search_domain( | ||
search, category, attrib_values, search_in_description=search_in_description | ||
) | ||
if "brand_id" in request.context: | ||
domain = expression.AND( | ||
[domain, [("product_brand_id", "=", request.context["brand_id"])]] | ||
) | ||
return domain | ||
|
||
@http.route( | ||
[ | ||
"/shop", | ||
"/shop/page/<int:page>", | ||
'/shop/category/<model("product.public.category"):category>', | ||
'/shop/category/<model("product.public.category"):category' | ||
">/page/<int:page>", # Continue previous line | ||
"/shop/brands", | ||
], | ||
type="http", | ||
auth="public", | ||
website=True, | ||
) | ||
def shop( | ||
self, | ||
page=0, | ||
category=None, | ||
search="", | ||
min_price=0.0, | ||
max_price=0.0, | ||
ppg=False, | ||
brand=None, | ||
**post | ||
): | ||
if brand: | ||
context = dict(request.context) | ||
context.setdefault("brand_id", int(brand)) | ||
request.update_context(**context) | ||
return super().shop( | ||
page=page, | ||
category=category, | ||
search=search, | ||
min_price=min_price, | ||
max_price=max_price, | ||
ppg=ppg, | ||
brand=brand, | ||
**post | ||
) | ||
|
||
# Method to get the brands. | ||
@http.route(["/page/product_brands"], type="http", auth="public", website=True) | ||
def product_brands(self, **post): | ||
b_obj = request.env["product.brand"] | ||
domain = [("website_published", "=", True)] | ||
if post.get("search"): | ||
domain += [("name", "ilike", post.get("search"))] | ||
brand_rec = b_obj.sudo().search(domain) | ||
|
||
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.render("website_sale_product_brand.product_brands", values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<!-- Menu in website for Brand --> | ||
<record id="menu_website_sale_brand" model="website.menu"> | ||
<field name="name">Shop by Brand</field> | ||
<field name="url">/page/product_brands</field> | ||
<field name="sequence" type="int">25</field> | ||
<field name="parent_id" ref="website.main_menu" /> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="product_brand_apple_demo" model="product.brand"> | ||
<field name="name">Apple</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="product.product_product_7" model="product.product"> | ||
<field name="product_brand_id" ref="product_brand_apple_demo" /> | ||
</record> | ||
<record id="product.product_product_9" model="product.product"> | ||
<field name="product_brand_id" ref="product_brand_apple_demo" /> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * website_sale_product_brand | ||
# | ||
# Translators: | ||
# OCA Transbot <transbot@odoo-community.org>, 2016 | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-11-29 01:20+0000\n" | ||
"PO-Revision-Date: 2016-11-29 01:20+0000\n" | ||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n" | ||
"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n" | ||
"Language: ar\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " | ||
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" | ||
|
||
#. module: website_sale_product_brand | ||
#: model_terms:ir.ui.view,arch_db:website_sale_product_brand.product_brands | ||
msgid "No Brands Found." | ||
msgstr "" | ||
|
||
#. module: website_sale_product_brand | ||
#: model_terms:ir.ui.view,arch_db:website_sale_product_brand.product_brands | ||
msgid "Product Brands" | ||
msgstr "" | ||
|
||
#. module: website_sale_product_brand | ||
#: model_terms:ir.ui.view,arch_db:website_sale_product_brand.product_brands | ||
msgid "Search" | ||
msgstr "" | ||
|
||
#. module: website_sale_product_brand | ||
#: model_terms:ir.ui.view,arch_db:website_sale_product_brand.product_brands | ||
msgid "Search..." | ||
msgstr "" | ||
|
||
#. module: website_sale_product_brand | ||
#: model:website.menu,name:website_sale_product_brand.menu_website_sale_brand | ||
msgid "Shop by Brand" | ||
msgstr "" | ||
|
||
#~ msgid "Website" | ||
#~ msgstr "الموقع" |
Oops, something went wrong.