Skip to content

Commit af31ea6

Browse files
committed
[MIG] website_sale_product_brand: Migration to 19.0
1 parent e7bff63 commit af31ea6

9 files changed

Lines changed: 81 additions & 46 deletions

File tree

website_sale_product_brand/README.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
15
==================================
26
Product Brand Filtering in Website
37
==================================
@@ -13,17 +17,17 @@ Product Brand Filtering in Website
1317
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1418
:target: https://odoo-community.org/page/development-status
1519
:alt: Beta
16-
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
1721
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1822
:alt: License: AGPL-3
1923
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github
20-
:target: https://github.com/OCA/e-commerce/tree/18.0/website_sale_product_brand
24+
:target: https://github.com/OCA/e-commerce/tree/19.0/website_sale_product_brand
2125
:alt: OCA/e-commerce
2226
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_product_brand
27+
:target: https://translation.odoo-community.org/projects/e-commerce-19-0/e-commerce-19-0-website_sale_product_brand
2428
:alt: Translate me on Weblate
2529
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=19.0
2731
:alt: Try me on Runboat
2832

2933
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -80,7 +84,7 @@ Bug Tracker
8084
Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/issues>`_.
8185
In case of trouble, please check there if your issue has already been reported.
8286
If you spotted it first, help us to smash it by providing a detailed and welcomed
83-
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_product_brand%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
87+
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_product_brand%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
8488

8589
Do not contact contributors directly about support or help with technical issues.
8690

@@ -109,6 +113,10 @@ Contributors
109113
- Carlos López
110114
- Pilar Vargas
111115

116+
- `Studio73 <https://www.studio73.es>`__:
117+
118+
- Alex Garcia <[alex@studio73.es]>
119+
112120
Maintainers
113121
-----------
114122

@@ -122,6 +130,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
122130
mission is to support the collaborative development of Odoo features and
123131
promote its widespread use.
124132

125-
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_sale_product_brand>`_ project on GitHub.
133+
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/19.0/website_sale_product_brand>`_ project on GitHub.
126134

127135
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

website_sale_product_brand/__manifest__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Tecnativa, "
99
"Odoo Community Association (OCA)",
1010
"website": "https://github.com/OCA/e-commerce",
11-
"version": "18.0.1.0.0",
11+
"version": "19.0.1.0.0",
1212
"license": "AGPL-3",
1313
"depends": ["product_brand", "website_sale"],
1414
"data": [
@@ -17,10 +17,6 @@
1717
"views/product_brand.xml",
1818
"views/product_brand_views.xml",
1919
],
20-
"demo": [
21-
"demo/product_brand_demo.xml",
22-
"demo/product_product_demo.xml",
23-
],
2420
"assets": {
2521
"web.assets_frontend": [
2622
"/website_sale_product_brand/static/src/scss/website_sale_product_brand.scss"

website_sale_product_brand/controllers/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33

44
from odoo import http
5+
from odoo.fields import Domain
56
from odoo.http import request
6-
from odoo.osv import expression
77

88
from odoo.addons.website_sale.controllers.main import QueryURL, WebsiteSale
99

@@ -28,7 +28,7 @@ def _get_search_options(
2828
conversion_rate=conversion_rate,
2929
**post,
3030
)
31-
res["brand"] = request.context.get("brand_id")
31+
res["brand"] = request.env.context.get("brand_id")
3232
return res
3333

3434
def _get_search_domain(
@@ -37,9 +37,9 @@ def _get_search_domain(
3737
domain = super()._get_search_domain(
3838
search, category, attrib_values, search_in_description=search_in_description
3939
)
40-
if "brand_id" in request.context:
41-
domain = expression.AND(
42-
[domain, [("product_brand_id", "=", request.context["brand_id"])]]
40+
if "brand_id" in request.env.context:
41+
domain = Domain.AND(
42+
[domain, [("product_brand_id", "=", request.env.context["brand_id"])]]
4343
)
4444
return domain
4545

@@ -68,7 +68,7 @@ def shop(
6868
**post,
6969
):
7070
if brand:
71-
context = dict(request.context)
71+
context = dict(request.env.context)
7272
context.setdefault("brand_id", int(brand))
7373
request.update_context(**context)
7474
return super().shop(

website_sale_product_brand/demo/product_brand_demo.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

website_sale_product_brand/demo/product_product_demo.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

website_sale_product_brand/readme/CONTRIBUTORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
> - Carlos López
1212
> - Pilar Vargas
1313
14+
- [Studio73](https://www.studio73.es):
15+
> - Alex Garcia <[alex@studio73.es]>
16+

website_sale_product_brand/static/description/index.html

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Product Brand Filtering in Website</title>
6+
<title>README.rst</title>
77
<style type="text/css">
88

99
/*
@@ -360,16 +360,21 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="product-brand-filtering-in-website">
364-
<h1 class="title">Product Brand Filtering in Website</h1>
363+
<div class="document">
365364

365+
366+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368+
</a>
369+
<div class="section" id="product-brand-filtering-in-website">
370+
<h1>Product Brand Filtering in Website</h1>
366371
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367372
!! This file is generated by oca-gen-addon-readme !!
368373
!! changes will be overwritten. !!
369374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370375
!! source digest: sha256:b9e4d313bc036276fc48d47dc2feadb3931434c3cf8897951620af315ddeb02e
371376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/e-commerce/tree/18.0/website_sale_product_brand"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_product_brand"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/e-commerce/tree/19.0/website_sale_product_brand"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/e-commerce-19-0/e-commerce-19-0-website_sale_product_brand"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373378
<p>This module was written to extend the functionality of product filtering
374379
on website. It will allow you to filter product based on its brand.</p>
375380
<p>While shopping online, we have seen various eShops having a feature to
@@ -392,7 +397,7 @@ <h1 class="title">Product Brand Filtering in Website</h1>
392397
</ul>
393398
</div>
394399
<div class="section" id="configuration">
395-
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
400+
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
396401
<p>In order to hide brands from the e-commerce:</p>
397402
<ol class="arabic simple">
398403
<li>Go to <em>Website &gt; eCommerce &gt; Product brands</em></li>
@@ -401,7 +406,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
401406
</ol>
402407
</div>
403408
<div class="section" id="usage">
404-
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
409+
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
405410
<p>Shop by brand feature is available on various famous e-commerce websites
406411
like amazon, flipkart and many. Shop by brand feature enables you to
407412
display product relevant to that particular brand.</p>
@@ -422,24 +427,24 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
422427
brand it will show product’s which is related to this brand.</p>
423428
</div>
424429
<div class="section" id="bug-tracker">
425-
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
430+
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
426431
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/e-commerce/issues">GitHub Issues</a>.
427432
In case of trouble, please check there if your issue has already been reported.
428433
If you spotted it first, help us to smash it by providing a detailed and welcomed
429-
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_product_brand%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
434+
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_product_brand%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
430435
<p>Do not contact contributors directly about support or help with technical issues.</p>
431436
</div>
432437
<div class="section" id="credits">
433-
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
438+
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
434439
<div class="section" id="authors">
435-
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
440+
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
436441
<ul class="simple">
437442
<li>Serpent Consulting Services Pvt. Ltd.</li>
438443
<li>Tecnativa</li>
439444
</ul>
440445
</div>
441446
<div class="section" id="contributors">
442-
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
447+
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
443448
<ul>
444449
<li><p class="first">Jay Vora &lt;<a class="reference external" href="mailto:jay.vora&#64;serpentcs.com">jay.vora&#64;serpentcs.com</a>&gt;</p>
445450
</li>
@@ -457,21 +462,29 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
457462
</ul>
458463
</blockquote>
459464
</li>
465+
<li><p class="first"><a class="reference external" href="https://www.studio73.es">Studio73</a>:</p>
466+
<blockquote>
467+
<ul class="simple">
468+
<li>Alex Garcia &lt;[<a class="reference external" href="mailto:alex&#64;studio73.es]">alex&#64;studio73.es]</a>&gt;</li>
469+
</ul>
470+
</blockquote>
471+
</li>
460472
</ul>
461473
</div>
462474
<div class="section" id="maintainers">
463-
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
475+
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
464476
<p>This module is maintained by the OCA.</p>
465477
<a class="reference external image-reference" href="https://odoo-community.org">
466478
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
467479
</a>
468480
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
469481
mission is to support the collaborative development of Odoo features and
470482
promote its widespread use.</p>
471-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/e-commerce/tree/18.0/website_sale_product_brand">OCA/e-commerce</a> project on GitHub.</p>
483+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/e-commerce/tree/19.0/website_sale_product_brand">OCA/e-commerce</a> project on GitHub.</p>
472484
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
473485
</div>
474486
</div>
475487
</div>
488+
</div>
476489
</body>
477490
</html>

website_sale_product_brand/static/src/js/tour.esm.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ registry.category("web_tour.tours").add("website_sale_product_brand", {
99
{
1010
trigger: "a[href='/page/product_brands']",
1111
content: "Go to 'Product brand' page",
12+
expectUnloadPage: true,
1213
run: "click",
1314
},
1415
{
@@ -19,11 +20,14 @@ registry.category("web_tour.tours").add("website_sale_product_brand", {
1920
{
2021
content: "Click to search Apple",
2122
trigger: 'form:has(input[name="search"]) button',
23+
expectUnloadPage: true,
2224
run: "click",
2325
},
2426
{
2527
content: "select Apple",
26-
trigger: 'section a div:contains("Apple")',
28+
trigger: 'section a:has(span:contains("Apple"))',
29+
expectUnloadPage: true,
30+
run: "click",
2731
},
2832
],
2933
});

website_sale_product_brand/tests/test_ui.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
22

33
import odoo.tests
4+
from odoo.tests import common as tests
45

56
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
67

@@ -11,6 +12,31 @@ class UICase(odoo.tests.HttpCase):
1112
def setUpClass(cls):
1213
super().setUpClass()
1314
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
15+
tests.new_test_user(
16+
cls.env,
17+
login="portal",
18+
password="portal",
19+
groups="base.group_portal",
20+
)
21+
brand = (
22+
cls.env["product.brand"]
23+
.sudo()
24+
.create(
25+
{
26+
"name": "Apple",
27+
"is_published": True,
28+
}
29+
)
30+
)
31+
cls.env["product.template"].sudo().create(
32+
{
33+
"name": "Apple Test Product",
34+
"sale_ok": True,
35+
"list_price": 10.0,
36+
"website_published": True,
37+
"product_brand_id": brand.id,
38+
}
39+
)
1440

1541
def test_ui_website(self):
1642
"""Test frontend tour."""

0 commit comments

Comments
 (0)