diff --git a/pos_hide_empty_category/README.rst b/pos_hide_empty_category/README.rst new file mode 100644 index 0000000000..748736255c --- /dev/null +++ b/pos_hide_empty_category/README.rst @@ -0,0 +1,99 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +===================================== +Point of Sale - Hide Empty Categories +===================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e8acc8f04a9a812743f1e57d72e1d83e7d7e282b8408f1927e30b6a72c9800b0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/16.0/pos_hide_empty_category + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_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/pos&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends Odoo Point Of Sale features, hidding empty PoS categories. + +this module can be usefull to avoid to display categories, if they contains only non saleable products +that can occurs frequently if your shop has seasonal products. + + +.. image:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_hide_empty_category/static/description/pos_category_tree_view.png + :width: 800 px + + +.. image:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_hide_empty_category/static/description/pos_front_ui.png + :width: 800 px + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* GRAP + +Contributors +~~~~~~~~~~~~ + +* Sylvain LE GAL + +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. + +.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainer `__: + +|maintainer-legalsylvain| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_hide_empty_category/__init__.py b/pos_hide_empty_category/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pos_hide_empty_category/__manifest__.py b/pos_hide_empty_category/__manifest__.py new file mode 100644 index 0000000000..8d2ba00033 --- /dev/null +++ b/pos_hide_empty_category/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Point of Sale - Hide Empty Categories", + "version": "16.0.1.0.0", + "category": "Point Of Sale", + "summary": """Hide PoS categories that doesn't have any products""", + "author": "GRAP, Odoo Community Association (OCA)", + "maintainers": ["legalsylvain"], + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "depends": ["point_of_sale"], + "data": [], + "assets": { + "point_of_sale.assets": [ + "pos_hide_empty_category/static/src/js/db.js", + ] + }, + "demo": [ + "demo/pos_category.xml", + ], +} diff --git a/pos_hide_empty_category/demo/pos_category.xml b/pos_hide_empty_category/demo/pos_category.xml new file mode 100644 index 0000000000..6b83897b89 --- /dev/null +++ b/pos_hide_empty_category/demo/pos_category.xml @@ -0,0 +1,20 @@ + + + + + + Empty Main Category + 99 + + + + Empty Child Category + + 100 + + + diff --git a/pos_hide_empty_category/i18n/fr.po b/pos_hide_empty_category/i18n/fr.po new file mode 100644 index 0000000000..a1496d029e --- /dev/null +++ b/pos_hide_empty_category/i18n/fr.po @@ -0,0 +1,9 @@ +#. module: pos_hide_empty_category +#: model:pos.category,name:pos_hide_empty_category.empty_child_category +msgid "Empty Child Category" +msgstr "" + +#. module: pos_hide_empty_category +#: model:pos.category,name:pos_hide_empty_category.empty_main_category +msgid "Empty Main Category" +msgstr "" diff --git a/pos_hide_empty_category/i18n/it.po b/pos_hide_empty_category/i18n/it.po new file mode 100644 index 0000000000..82258860a5 --- /dev/null +++ b/pos_hide_empty_category/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_hide_empty_category +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-03-23 12:22+0000\n" +"Last-Translator: mymage \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 4.14.1\n" + +#. module: pos_hide_empty_category +#: model:pos.category,name:pos_hide_empty_category.empty_child_category +msgid "Empty Child Category" +msgstr "Categoria figlia vuota" + +#. module: pos_hide_empty_category +#: model:pos.category,name:pos_hide_empty_category.empty_main_category +msgid "Empty Main Category" +msgstr "Categoria principale vuota" diff --git a/pos_hide_empty_category/i18n/pos_hide_empty_category.pot b/pos_hide_empty_category/i18n/pos_hide_empty_category.pot new file mode 100644 index 0000000000..e23b3f24cd --- /dev/null +++ b/pos_hide_empty_category/i18n/pos_hide_empty_category.pot @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_hide_empty_category +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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: pos_hide_empty_category +#: model:pos.category,name:pos_hide_empty_category.empty_child_category +msgid "Empty Child Category" +msgstr "" + +#. module: pos_hide_empty_category +#: model:pos.category,name:pos_hide_empty_category.empty_main_category +msgid "Empty Main Category" +msgstr "" + diff --git a/pos_hide_empty_category/readme/CONTRIBUTORS.rst b/pos_hide_empty_category/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..9f76a75bc1 --- /dev/null +++ b/pos_hide_empty_category/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sylvain LE GAL diff --git a/pos_hide_empty_category/readme/DESCRIPTION.rst b/pos_hide_empty_category/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..142420c1db --- /dev/null +++ b/pos_hide_empty_category/readme/DESCRIPTION.rst @@ -0,0 +1,12 @@ +This module extends Odoo Point Of Sale features, hidding empty PoS categories. + +this module can be usefull to avoid to display categories, if they contains only non saleable products +that can occurs frequently if your shop has seasonal products. + + +.. image:: ../static/description/pos_category_tree_view.png + :width: 800 px + + +.. image:: ../static/description/pos_front_ui.png + :width: 800 px diff --git a/pos_hide_empty_category/static/description/icon.png b/pos_hide_empty_category/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_hide_empty_category/static/description/icon.png differ diff --git a/pos_hide_empty_category/static/description/index.html b/pos_hide_empty_category/static/description/index.html new file mode 100644 index 0000000000..8e3ff1d910 --- /dev/null +++ b/pos_hide_empty_category/static/description/index.html @@ -0,0 +1,435 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Point of Sale - Hide Empty Categories

+ +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runboat

+

This module extends Odoo Point Of Sale features, hidding empty PoS categories.

+

this module can be usefull to avoid to display categories, if they contains only non saleable products +that can occurs frequently if your shop has seasonal products.

+https://raw.githubusercontent.com/OCA/pos/16.0/pos_hide_empty_category/static/description/pos_category_tree_view.png +https://raw.githubusercontent.com/OCA/pos/16.0/pos_hide_empty_category/static/description/pos_front_ui.png +

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • GRAP
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

legalsylvain

+

This module is part of the OCA/pos project on GitHub.

+

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

+
+
+
+
+ + diff --git a/pos_hide_empty_category/static/description/pos_category_tree_view.png b/pos_hide_empty_category/static/description/pos_category_tree_view.png new file mode 100644 index 0000000000..0c5eaefcc8 Binary files /dev/null and b/pos_hide_empty_category/static/description/pos_category_tree_view.png differ diff --git a/pos_hide_empty_category/static/description/pos_front_ui.png b/pos_hide_empty_category/static/description/pos_front_ui.png new file mode 100644 index 0000000000..5c99cc14a1 Binary files /dev/null and b/pos_hide_empty_category/static/description/pos_front_ui.png differ diff --git a/pos_hide_empty_category/static/src/js/db.js b/pos_hide_empty_category/static/src/js/db.js new file mode 100644 index 0000000000..26df46cdfd --- /dev/null +++ b/pos_hide_empty_category/static/src/js/db.js @@ -0,0 +1,18 @@ +/* + Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) + @author: Sylvain LE GAL + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +*/ + +odoo.define("pos_hide_empty_category.db", function (require) { + "use strict"; + + var PosDB = require("point_of_sale.DB"); + + PosDB.include({ + get_category_childs_ids: function (categ_id) { + const res = this.category_childs[categ_id] || []; + return _.filter(res, (categ_id) => this.product_by_category_id[categ_id]); + }, + }); +}); diff --git a/setup/pos_hide_empty_category/odoo/addons/pos_hide_empty_category b/setup/pos_hide_empty_category/odoo/addons/pos_hide_empty_category new file mode 120000 index 0000000000..0d925a2f53 --- /dev/null +++ b/setup/pos_hide_empty_category/odoo/addons/pos_hide_empty_category @@ -0,0 +1 @@ +../../../../pos_hide_empty_category \ No newline at end of file diff --git a/setup/pos_hide_empty_category/setup.py b/setup/pos_hide_empty_category/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_hide_empty_category/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)