Skip to content

Commit

Permalink
Merge PR #1011 into 18.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Feb 7, 2025
2 parents 54ba3e0 + c53530c commit d685ceb
Show file tree
Hide file tree
Showing 21 changed files with 901 additions and 0 deletions.
106 changes: 106 additions & 0 deletions website_sale_hide_empty_category/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
====================================
Website Sale - Hide Empty Categories
====================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d10828f104845b192f732918c09e56ca4f937bdf26b3cbec8ffec7a10267befb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-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/18.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-18-0/e-commerce-18-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=18.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:%2018.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 <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:

- Carlos Roca
- Pilar Vargas

- Radovan Skolnik <[email protected]>

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/18.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": "18.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: 2021-02-25 17:46+0000\n"
"Last-Translator: claudiagn <[email protected]>\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 4.3.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: 2021-02-25 17:45+0000\n"
"Last-Translator: claudiagn <[email protected]>\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 4.3.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/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: 2020-12-15 13:19+0000\n"
"Last-Translator: Bosd <[email protected]>\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 4.3.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"
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 15.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 ""
4 changes: 4 additions & 0 deletions website_sale_hide_empty_category/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import product_public_category
22 changes: 22 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,22 @@
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models


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")
def _compute_has_product_recursive(self):
for category in self:
category.has_product_recursive = bool(
category.product_tmpl_ids
or any(child.has_product_recursive for child in category.child_id)
)
3 changes: 3 additions & 0 deletions website_sale_hide_empty_category/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
9 changes: 9 additions & 0 deletions website_sale_hide_empty_category/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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.
5 changes: 5 additions & 0 deletions website_sale_hide_empty_category/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Ted Salmon \<<[email protected]>\>
- [Tecnativa](https://www.tecnativa.com):
- Carlos Roca
- Pilar Vargas
- Radovan Skolnik \<<[email protected]>\>
2 changes: 2 additions & 0 deletions website_sale_hide_empty_category/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removes any category links from the Shop which have no products
associated to them.
1 change: 1 addition & 0 deletions website_sale_hide_empty_category/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Once this module is installed and configured, go to ‘/shop’. Empty categories will not be show.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d685ceb

Please sign in to comment.