Skip to content

Commit

Permalink
[MIG] website_sale_attribute_filter_category: Migration to 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-teruel committed Nov 27, 2019
1 parent 6371469 commit 300a2ba
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 65 deletions.
23 changes: 18 additions & 5 deletions website_sale_attribute_filter_category/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Website Sale Attribute Filter Category
: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/11.0/website_sale_attribute_filter_category
:target: https://github.com/OCA/e-commerce/tree/12.0/website_sale_attribute_filter_category
: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-11-0/e-commerce-11-0-website_sale_attribute_filter_category
:target: https://translation.odoo-community.org/projects/e-commerce-12-0/e-commerce-12-0-website_sale_attribute_filter_category
: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/11.0
:target: https://runbot.odoo-community.org/runbot/113/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -33,6 +33,19 @@ product attributes filter by their categories.
.. contents::
:local:

Configuration
=============

To configure this module, you need to:

* Go to 'Website > Configuration > Attribute Categories' and create one.
* Go to 'Website > Configuration > Attributes' and create one or more with
this category.
* Go to 'Website > Configuration > Attribute Values' and create more than one
value for this attribute.
* Go to 'Website > Products > Products' and create a product with this
attribute and assign it an attribute value.

Usage
=====

Expand All @@ -46,7 +59,7 @@ 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_attribute_filter_category%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_attribute_filter_category%0Aversion:%2012.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.

Expand Down Expand Up @@ -78,6 +91,6 @@ 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/11.0/website_sale_attribute_filter_category>`_ project on GitHub.
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/12.0/website_sale_attribute_filter_category>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 1 addition & 4 deletions website_sale_attribute_filter_category/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
'name': 'Website Sale Attribute Filter Category',
'summary': 'Allow group attributes in shop by categories',
'version': '11.0.1.0.0',
'version': '12.0.1.0.0',
'development_status': 'Beta',
'category': 'Website',
'website': 'https://github.com/OCA/e-commerce',
Expand All @@ -18,7 +18,4 @@
'views/assets.xml',
'views/templates.xml',
],
'demo': [
'data/demo.xml',
],
}
31 changes: 0 additions & 31 deletions website_sale_attribute_filter_category/data/demo.xml

This file was deleted.

9 changes: 9 additions & 0 deletions website_sale_attribute_filter_category/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To configure this module, you need to:

* Go to 'Website > Configuration > Attribute Categories' and create one.
* Go to 'Website > Configuration > Attributes' and create one or more with
this category.
* Go to 'Website > Configuration > Attribute Values' and create more than one
value for this attribute.
* Go to 'Website > Products > Products' and create a product with this
attribute and assign it an attribute value.
Original file line number Diff line number Diff line change
Expand Up @@ -367,48 +367,62 @@ <h1 class="title">Website Sale Attribute Filter Category</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/e-commerce/tree/11.0/website_sale_attribute_filter_category"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_attribute_filter_category"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/113/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/e-commerce/tree/12.0/website_sale_attribute_filter_category"><img alt="OCA/e-commerce" src="https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/e-commerce-12-0/e-commerce-12-0-website_sale_attribute_filter_category"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/113/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of website sale module to allow to group
product attributes filter by their categories.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ul class="simple">
<li>Go to ‘Website &gt; Configuration &gt; Attribute Categories’ and create one.</li>
<li>Go to ‘Website &gt; Configuration &gt; Attributes’ and create one or more with
this category.</li>
<li>Go to ‘Website &gt; Configuration &gt; Attribute Values’ and create more than one
value for this attribute.</li>
<li>Go to ‘Website &gt; Products &gt; Products’ and create a product with this
attribute and assign it an attribute value.</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
<ol class="arabic simple">
<li>Go to Website Shop.</li>
<li>Active filter by attributes in “Customize” option in top menu.</li>
<li>Now you can see product attributes filter grouped by categories.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/e-commerce/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_attribute_filter_category%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_attribute_filter_category%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<blockquote>
Expand All @@ -420,13 +434,13 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/e-commerce/tree/11.0/website_sale_attribute_filter_category">OCA/e-commerce</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/e-commerce/tree/12.0/website_sale_attribute_filter_category">OCA/e-commerce</a> project on GitHub.</p>
<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>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ odoo.define("website_sale_attribute_filter_category.tour", function (require) {
var base = require("web_editor.base");

var steps = [
{
trigger: "a:contains('Customize')",
},
{
trigger: "a:contains('Product Attribute')",
},
{
trigger: "a[href='/shop']",
},
{
trigger: "a:contains('iPod')",
extra_trigger: ".js_attributes:has(span:contains('Test Category'))",
trigger: "a:contains('Customizable Desk')",
extra_trigger: ".js_attributes:has(span:contains('Test category'))",
},
];
tour.register("website_sale_attribute_filter_category",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,53 @@

class websiteSaleAttributeFilterCategoryHttpCase(HttpCase):

def setUp(self):
super().setUp()
# Models
AttributeCategory = self.env['product.attribute.category']
ProductAttribute = self.env['product.attribute']
ProductAttributeValue = self.env['product.attribute.value']
ProductAttributeLine = self.env['product.template.attribute.line']
self.attribute_category = AttributeCategory.create({
'name': 'Test category',
})
self.product_attribute = ProductAttribute.create({
'name': 'Test',
'website_published': True,
'create_variant': 'no_variant',
'category_id': self.attribute_category.id,
})
self.product_attribute_value_test_1 = ProductAttributeValue.create({
'name': 'Test v1',
'attribute_id': self.product_attribute.id,
})
self.product_attribute_value_test_2 = ProductAttributeValue.create({
'name': 'Test v2',
'attribute_id': self.product_attribute.id,
})
self.product_template = self.env.ref(
'product.product_product_4_product_template')
self.product_attribute_line = ProductAttributeLine.create({
'product_tmpl_id': self.product_template.id,
'attribute_id': self.product_attribute.id,
'value_ids': [(6, 0,
[self.product_attribute_value_test_1.id,
self.product_attribute_value_test_2.id]
)]
})
self.product_template.write({
'attribute_line_ids': [(4, self.product_attribute_line.id)]
})
# Active attribute's filter in /shop. By default it's disabled.
self.env.ref('website_sale.products_attributes').active = True

def test_ui_website(self):
"""Test frontend tour."""
tour = (
"odoo.__DEBUG__.services['web_tour.tour']",
"website_sale_attribute_filter_category",
)
self.phantom_js(
self.browser_js(
url_path="/",
code="%s.run('%s')" % tour,
ready="%s.tours['%s'].ready" % tour,
Expand Down
2 changes: 1 addition & 1 deletion website_sale_attribute_filter_category/views/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<i class="fa fas"/>
<span t-esc="attr_category[1]"/>
</a>
<ul t-attf-id="collapse{{attr_category_index}}" t-attf-class="nav nav-pills nav-stacked #{'collapse in' if values_selected else 'collapse'}">
<ul t-attf-id="collapse{{attr_category_index}}" t-attf-class="nav nav-pills nav-stacked #{'collapse in show' if values_selected else 'collapse'}">

<t>$0</t>

Expand Down

0 comments on commit 300a2ba

Please sign in to comment.