Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d1b5bcd
[ADD] website_sale_category_empty: Create module (#342)
May 22, 2017
4c97f29
[MIG] website_sale_hide_empty_category: Migration to 11.0
remytms Oct 27, 2018
72223c2
[MIG] Migrated to Odoo 12
wpichler Nov 20, 2019
a34f5eb
[IMP] : black, isort, prettier
CarlosRoca13 Jun 1, 2020
f1acc34
[MIG] website_sale_hide_empty_category: Migration to v13
CarlosRoca13 Jun 1, 2020
01c25ae
allow for recursive evaluation
Rad0van Nov 5, 2020
a3e9133
Added translation using Weblate (Dutch)
bosd Dec 15, 2020
8ece52f
Added translation using Weblate (Catalan)
claudiagn Feb 25, 2021
d52f005
Translated using Weblate (Spanish)
claudiagn Feb 25, 2021
1756b2a
[IMP] Update dotfiles + switch to GH actions
pedrobaeza May 13, 2022
c81255d
[IMP] website_sale_hide_empty_category: black, isort, prettier
CarlosRoca13 May 23, 2022
26b7869
[MIG] website_sale_hide_empty_category: Migration to 15.0
CarlosRoca13 May 23, 2022
7e0f341
[IMP] website_sale_hide_empty_category: test performance improvement
josep-tecnativa Oct 18, 2023
6c7d244
[IMP] website_sale_hide_empty_category: pre-commit auto fixes
pilarvargas-tecnativa Jan 28, 2025
0ffcd3d
[MIG] website_sale_hide_empty_category: Migration to version 17.0
pilarvargas-tecnativa Jan 28, 2025
a7d775d
[IMP] website_sale_hide_empty_category: pre-commit auto fixes
pilarvargas-tecnativa Jan 28, 2025
5770cde
[MIG] website_sale_hide_empty_category: Migration to version 18.0
pilarvargas-tecnativa Jan 28, 2025
b4f8730
[UPD] Update website_sale_hide_empty_category.pot
Feb 7, 2025
097103d
[BOT] post-merge updates
OCA-git-bot Feb 7, 2025
7c2e0cd
Added translation using Weblate (Italian)
mymage Feb 9, 2025
fb3f4e1
Translated using Weblate (Italian)
mymage Feb 9, 2025
54080e9
Added translation using Weblate (Portuguese (Brazil))
marcelsavegnago Jun 29, 2025
1bd6d17
Translated using Weblate (Catalan)
weblate Feb 25, 2026
db5a49e
Translated using Weblate (Spanish)
weblate Feb 25, 2026
9e47a40
Translated using Weblate (Dutch)
weblate Feb 25, 2026
a2567a7
Translated using Weblate (Italian)
mymage Feb 25, 2026
57d6a84
Translated using Weblate (Portuguese (Brazil))
weblate Feb 25, 2026
8b1ad97
[FIX] website_sale_hide_empty_categories: respect product website vis…
pilarvargas-tecnativa Mar 31, 2026
d35eaf2
[FIX] website_sale_hide_empty_category: use shop product domain
pilarvargas-tecnativa May 18, 2026
e2a757f
[BOT] post-merge updates
OCA-git-bot May 22, 2026
771f7be
Added translation using Weblate (Slovenian)
sysadminmatmoz Jun 9, 2026
d62acd5
Translated using Weblate (Slovenian)
sysadminmatmoz Jun 9, 2026
c5968ac
Translated using Weblate (Slovenian)
sysadminmatmoz Jun 27, 2026
56dc368
[FIX] website_sale_*: remove deprecated test key from tour
pilarvargas-tecnativa Jul 21, 2026
9ea0ea3
[BOT] post-merge updates
OCA-git-bot Jul 21, 2026
8235deb
[MIG] website_sale_hide_empty_category: Migration to 19.0
prayagrk Jul 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions website_sale_hide_empty_category/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

====================================
Website Sale - Hide Empty Categories
====================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:72c53172beae1416c2f8cfb67668bcbfba5dbff39310b0c6d8c9df8d54ca7c46
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github
:target: https://github.com/OCA/e-commerce/tree/19.0/website_sale_hide_empty_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-19-0/e-commerce-19-0-website_sale_hide_empty_category
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Removes any category links from the Shop which have no products
associated to them.

**Table of contents**

.. contents::
:local:

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

When the module is installed, by default the options to hide empty
categories are active.

These options can be configured in the web editor. To do this, go to
‘/shop’ and activate or deactivate the options to hide empty categories
from the web editor in the ‘Customize’ tab.

There are two options:

- Hide Empty Category Filmstrip: to hide/show empty categories in the
top category bar.
- Hide Empty Category list: to hide/show empty categories in the left
category list.

Usage
=====

Once this module is installed and configured, go to ‘/shop’. Empty
categories will not be show.

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_hide_empty_category%0Aversion:%2019.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
-------

* LasLabs

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

- Ted Salmon <tsalmon@laslabs.com>
- `Tecnativa <https://www.tecnativa.com>`__:

- Carlos Roca
- Pilar Vargas

- Radovan Skolnik <radovan@skolnik.info>

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/19.0/website_sale_hide_empty_category>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions website_sale_hide_empty_category/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import models
20 changes: 20 additions & 0 deletions website_sale_hide_empty_category/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2017 LasLabs Inc. <https://laslabs.com/>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Website Sale - Hide Empty Categories",
"summary": "Hide any Product Categories that are empty",
"version": "19.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
"author": "LasLabs, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["website_sale"],
"data": ["views/website_sale_templates.xml"],
"assets": {
"web.assets_tests": [
"/website_sale_hide_empty_category/static/src/js/tour.esm.js"
],
},
}
27 changes: 27 additions & 0 deletions website_sale_hide_empty_category/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_empty_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-02-25 07:27+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: website_sale_hide_empty_category
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category__has_product_recursive
msgid "This category or one of its children has products"
msgstr "Aquesta categoria o un dels seus fills té productes"

#. module: website_sale_hide_empty_category
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
msgid "Website Product Category"
msgstr "Categoria de producte del lloc web"
31 changes: 31 additions & 0 deletions website_sale_hide_empty_category/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_empty_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2026-02-25 07:28+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: website_sale_hide_empty_category
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category__has_product_recursive
msgid "This category or one of its children has products"
msgstr "Aquesta categoria o un dels seus fills té productes"

#. module: website_sale_hide_empty_category
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
msgid "Website Product Category"
msgstr "Categoría del Producto"

#~ msgid "Products"
#~ msgstr "Productos"
27 changes: 27 additions & 0 deletions website_sale_hide_empty_category/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_empty_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-02-25 07:30+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: website_sale_hide_empty_category
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category__has_product_recursive
msgid "This category or one of its children has products"
msgstr "Questa categoria o una delle sue figlie contiene prodotti"

#. module: website_sale_hide_empty_category
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
msgid "Website Product Category"
msgstr "Categoria prodotto sito web"
27 changes: 27 additions & 0 deletions website_sale_hide_empty_category/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_empty_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-02-25 07:29+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: none\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: website_sale_hide_empty_category
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category__has_product_recursive
msgid "This category or one of its children has products"
msgstr "Deze categorie of een van de subcategorieen bevat geen producten"

#. module: website_sale_hide_empty_category
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
msgid "Website Product Category"
msgstr "Website Product Categorie"
27 changes: 27 additions & 0 deletions website_sale_hide_empty_category/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_empty_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-02-25 07:30+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: website_sale_hide_empty_category
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category__has_product_recursive
msgid "This category or one of its children has products"
msgstr ""

#. module: website_sale_hide_empty_category
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
msgid "Website Product Category"
msgstr ""
28 changes: 28 additions & 0 deletions website_sale_hide_empty_category/i18n/sl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_empty_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-06-27 07:46+0000\n"
"Last-Translator: Matjaz Mozetic <matjaz@luxim.si>\n"
"Language-Team: none\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || "
"n%100==4 ? 2 : 3;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: website_sale_hide_empty_category
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category__has_product_recursive
msgid "This category or one of its children has products"
msgstr "Ta kategorija ali ena od njenih podkategorij vsebuje proizvode"

#. module: website_sale_hide_empty_category
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
msgid "Website Product Category"
msgstr "Spletna kategorija proizvoda"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_hide_empty_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_sale_hide_empty_category
#: model:ir.model.fields,field_description:website_sale_hide_empty_category.field_product_public_category__has_product_recursive
msgid "This category or one of its children has products"
msgstr ""

#. module: website_sale_hide_empty_category
#: model:ir.model,name:website_sale_hide_empty_category.model_product_public_category
msgid "Website Product Category"
msgstr ""
5 changes: 5 additions & 0 deletions website_sale_hide_empty_category/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import product_public_category
from . import website_snippet_filter
30 changes: 30 additions & 0 deletions website_sale_hide_empty_category/models/product_public_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models
from odoo.fields import Domain


class ProductPublicCategory(models.Model):
_inherit = "product.public.category"

has_product_recursive = fields.Boolean(
string="This category or one of its children has products",
compute="_compute_has_product_recursive",
recursive=True,
)

@api.depends("product_tmpl_ids", "child_id.has_product_recursive")
@api.depends_context("website_id")
def _compute_has_product_recursive(self):
for category in self:
website = self.env["website"].get_current_website()
website_domain = (
Domain([("is_published", "=", True)]) & website.sale_product_domain()
)
has_products = bool(
category.product_tmpl_ids.filtered_domain(website_domain)
)
category.has_product_recursive = has_products or any(
child.has_product_recursive for child in category.child_id
)
Loading
Loading