Skip to content

Commit d89f242

Browse files
authored
Merge pull request #256 from remytms/11.0-mig-website_sale_hide_empty_category
[MIG] website_sale_hide_empty_category: Migration to 11.0
2 parents 98242a9 + ee7b507 commit d89f242

File tree

7 files changed

+145
-0
lines changed

7 files changed

+145
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
2+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
3+
:alt: License: LGPL-3
4+
5+
====================================
6+
Website Sale - Hide Empty Categories
7+
====================================
8+
9+
Removes any category links from the Shop which have no products associated
10+
to them.
11+
12+
Usage
13+
=====
14+
15+
Simply install the module and refresh your view. You will see the empty
16+
categories disappear
17+
18+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
19+
:alt: Try me on Runbot
20+
:target: https://runbot.odoo-community.org/runbot/186/11.0
21+
22+
Bug Tracker
23+
===========
24+
25+
Bugs are tracked on `GitHub Issues
26+
<https://github.com/OCA/website/issues>`_. In case of trouble, please
27+
check there if your issue has already been reported. If you spotted it first,
28+
help us smash it by providing detailed and welcomed feedback.
29+
30+
Credits
31+
=======
32+
33+
Images
34+
------
35+
36+
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
37+
38+
Contributors
39+
------------
40+
41+
* Ted Salmon <tsalmon@laslabs.com>
42+
43+
Maintainer
44+
----------
45+
46+
.. image:: https://odoo-community.org/logo.png
47+
:alt: Odoo Community Association
48+
:target: https://odoo-community.org
49+
50+
This module is maintained by the OCA.
51+
52+
OCA, or the Odoo Community Association, is a nonprofit organization whose
53+
mission is to support the collaborative development of Odoo features and
54+
promote its widespread use.
55+
56+
To contribute to this module, please visit https://odoo-community.org.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2017 LasLabs Inc.
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
4+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2017 LasLabs Inc. <https://laslabs.com/>
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
{
4+
"name": "Website Sale - Hide Empty Categories",
5+
"summary": "Hide any Product Categories that are empty",
6+
"version": "11.0.1.0.0",
7+
"category": "Website",
8+
"website": "https://github.com/OCA/e-commerce/",
9+
"author": "LasLabs, Odoo Community Association (OCA)",
10+
"license": "LGPL-3",
11+
"application": False,
12+
"installable": True,
13+
"depends": [
14+
"website_sale",
15+
],
16+
"data": [
17+
"views/website_sale_templates.xml",
18+
],
19+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * website_sale_hide_empty_category
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 11.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: <>\n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: website_sale_hide_empty_category
17+
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category_product_ids
18+
msgid "Products"
19+
msgstr ""
20+
21+
#. module: website_sale_hide_empty_category
22+
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
23+
msgid "Website Product Category"
24+
msgstr ""
25+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2017 LasLabs Inc.
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
4+
from . import product_public_category
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2017 LasLabs Inc.
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
4+
from odoo import fields, models
5+
6+
7+
class ProductPublicCategory(models.Model):
8+
_inherit = 'product.public.category'
9+
10+
# This module relies on the M2M relation built from `product.template` to
11+
# `product.public.category` named `public_categ_ids`
12+
product_ids = fields.Many2many(
13+
comodel_name='product.template',
14+
string='Products',
15+
relation='product_public_category_product_template_rel',
16+
column1='product_public_category_id',
17+
column2='product_template_id',
18+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2017 LasLabs Inc.
3+
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
4+
-->
5+
6+
<odoo>
7+
8+
<template inherit_id="website_sale.categories_recursive"
9+
id="hide_categories_recursive"
10+
active="True"
11+
customize_show="True"
12+
name="Hide Empty Category list">
13+
<xpath expr="//t[@t-name='website_sale.categories_recursive']"
14+
position="attributes">
15+
<attribute name="t-if">c.product_ids</attribute>
16+
</xpath>
17+
</template>
18+
19+
</odoo>

0 commit comments

Comments
 (0)