From 3c62c275433c2d6e2447d14927361667b14fee76 Mon Sep 17 00:00:00 2001 From: Pieter Paulussen Date: Fri, 19 Jul 2024 12:13:15 +0200 Subject: [PATCH] [IMP] website_sale_product_assortment: pre-commit auto fixes --- website_sale_product_assortment/README.rst | 63 ++++++++++--------- .../__manifest__.py | 2 +- .../controllers/website_sale.py | 7 +-- .../pyproject.toml | 3 + .../readme/CONFIGURE.md | 15 +++++ .../readme/CONFIGURE.rst | 14 ----- .../readme/CONTRIBUTORS.md | 9 +++ .../readme/CONTRIBUTORS.rst | 9 --- .../readme/DESCRIPTION.md | 2 + .../readme/DESCRIPTION.rst | 1 - .../static/description/index.html | 55 ++++++++-------- .../static/src/js/assortment_list_preview.js | 6 +- .../static/src/js/variant_mixin.js | 2 +- 13 files changed, 97 insertions(+), 91 deletions(-) create mode 100644 website_sale_product_assortment/pyproject.toml create mode 100644 website_sale_product_assortment/readme/CONFIGURE.md delete mode 100644 website_sale_product_assortment/readme/CONFIGURE.rst create mode 100644 website_sale_product_assortment/readme/CONTRIBUTORS.md delete mode 100644 website_sale_product_assortment/readme/CONTRIBUTORS.rst create mode 100644 website_sale_product_assortment/readme/DESCRIPTION.md delete mode 100644 website_sale_product_assortment/readme/DESCRIPTION.rst diff --git a/website_sale_product_assortment/README.rst b/website_sale_product_assortment/README.rst index 3b3b565de8..0cec2a1055 100644 --- a/website_sale_product_assortment/README.rst +++ b/website_sale_product_assortment/README.rst @@ -17,18 +17,19 @@ eCommerce product assortment :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/16.0/website_sale_product_assortment + :target: https://github.com/OCA/e-commerce/tree/17.0/website_sale_product_assortment :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-16-0/e-commerce-16-0-website_sale_product_assortment + :target: https://translation.odoo-community.org/projects/e-commerce-17-0/e-commerce-17-0-website_sale_product_assortment :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=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module allows to set e-commerce restrictions on product assortments. +This module allows to set e-commerce restrictions on product +assortments. **Table of contents** @@ -38,20 +39,21 @@ This module allows to set e-commerce restrictions on product assortments. Configuration ============= -To see this module working, you have to define a product assortment and select -an option on the website availability field. - -#. **Don't apply restriction**: This option will not set any kind of restriction on -product items. -#. **Avoid to show non available products**: This option will hide on the e-commerce, the -products that are not added to the products domain. If a product template has at least -one allowed variant to show, the product will appear on the product items view but only -that variants will be able to be bought. -#. **Avoid selling not available products**: This option will restrict to buy the -products that are added to the assortment on the e-commerce. To inform the clients, -two more fields were added: "Message when unavailable" and "Assortment information". -The first one will add a short description to the product item and the other one will set a -detailed description on the product sheet. This second one is editable from the website editor. +To see this module working, you have to define a product assortment and +select an option on the website availability field. + +#. **Don't apply restriction**: This option will not set any kind of +restriction on product items. #. **Avoid to show non available +products**: This option will hide on the e-commerce, the products that +are not added to the products domain. If a product template has at least +one allowed variant to show, the product will appear on the product +items view but only that variants will be able to be bought. #. **Avoid +selling not available products**: This option will restrict to buy the +products that are added to the assortment on the e-commerce. To inform +the clients, two more fields were added: "Message when unavailable" and +"Assortment information". The first one will add a short description to +the product item and the other one will set a detailed description on +the product sheet. This second one is editable from the website editor. Bug Tracker =========== @@ -59,7 +61,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -67,25 +69,26 @@ Credits ======= Authors -~~~~~~~ +------- * Tecnativa Contributors -~~~~~~~~~~~~ +------------ -* `Tecnativa `_: +- `Tecnativa `__: - * Carlos Roca - * Pedro M. Baeza - * Stefan Ungureanu - * Pilar Vargas + - Carlos Roca + - Pedro M. Baeza + - Stefan Ungureanu + - Pilar Vargas -* `Ooops `_: - * Ashish Hirpara (https://ashish-hirpara.com) +- `Ooops `__: + + - Ashish Hirpara (https://ashish-hirpara.com) Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -105,6 +108,6 @@ Current `maintainer `__: |maintainer-CarlosRoca13| -This module is part of the `OCA/e-commerce `_ project on GitHub. +This module is part of the `OCA/e-commerce `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_product_assortment/__manifest__.py b/website_sale_product_assortment/__manifest__.py index 218678108f..b997348357 100644 --- a/website_sale_product_assortment/__manifest__.py +++ b/website_sale_product_assortment/__manifest__.py @@ -3,7 +3,7 @@ { "name": "eCommerce product assortment", "summary": "Use product assortments to display products available on e-commerce.", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "development_status": "Beta", "license": "AGPL-3", "category": "Website", diff --git a/website_sale_product_assortment/controllers/website_sale.py b/website_sale_product_assortment/controllers/website_sale.py index 20252bafb8..f8b64a205c 100644 --- a/website_sale_product_assortment/controllers/website_sale.py +++ b/website_sale_product_assortment/controllers/website_sale.py @@ -30,8 +30,7 @@ def _get_products_allowed(self): if ( # Set active_test to False to allow filtering by partners # that are not active, (for example Public User) - partner - & assortment.with_context(active_test=False).all_partner_ids + partner & assortment.with_context(active_test=False).all_partner_ids ): assortment_restriction = True allowed_product_ids = allowed_product_ids.union( @@ -58,7 +57,7 @@ def _get_search_options( min_price=0.0, max_price=0.0, conversion_rate=1, - **post + **post, ): """Overriding _get_search_options method to avoid show product templates that has all their variants not allowed to be shown.""" @@ -69,7 +68,7 @@ def _get_search_options( min_price=min_price, max_price=max_price, conversion_rate=conversion_rate, - **post + **post, ) allowed_product_ids, assortment_restriction = self._get_products_allowed() if assortment_restriction: diff --git a/website_sale_product_assortment/pyproject.toml b/website_sale_product_assortment/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_sale_product_assortment/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_sale_product_assortment/readme/CONFIGURE.md b/website_sale_product_assortment/readme/CONFIGURE.md new file mode 100644 index 0000000000..c30d986794 --- /dev/null +++ b/website_sale_product_assortment/readme/CONFIGURE.md @@ -0,0 +1,15 @@ +To see this module working, you have to define a product assortment and +select an option on the website availability field. + +#\. **Don't apply restriction**: This option will not set any kind of +restriction on product items. \#. **Avoid to show non available +products**: This option will hide on the e-commerce, the products that +are not added to the products domain. If a product template has at least +one allowed variant to show, the product will appear on the product +items view but only that variants will be able to be bought. \#. **Avoid +selling not available products**: This option will restrict to buy the +products that are added to the assortment on the e-commerce. To inform +the clients, two more fields were added: "Message when unavailable" and +"Assortment information". The first one will add a short description to +the product item and the other one will set a detailed description on +the product sheet. This second one is editable from the website editor. diff --git a/website_sale_product_assortment/readme/CONFIGURE.rst b/website_sale_product_assortment/readme/CONFIGURE.rst deleted file mode 100644 index 8387e8b3a4..0000000000 --- a/website_sale_product_assortment/readme/CONFIGURE.rst +++ /dev/null @@ -1,14 +0,0 @@ -To see this module working, you have to define a product assortment and select -an option on the website availability field. - -#. **Don't apply restriction**: This option will not set any kind of restriction on -product items. -#. **Avoid to show non available products**: This option will hide on the e-commerce, the -products that are not added to the products domain. If a product template has at least -one allowed variant to show, the product will appear on the product items view but only -that variants will be able to be bought. -#. **Avoid selling not available products**: This option will restrict to buy the -products that are added to the assortment on the e-commerce. To inform the clients, -two more fields were added: "Message when unavailable" and "Assortment information". -The first one will add a short description to the product item and the other one will set a -detailed description on the product sheet. This second one is editable from the website editor. diff --git a/website_sale_product_assortment/readme/CONTRIBUTORS.md b/website_sale_product_assortment/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..69b0690b5e --- /dev/null +++ b/website_sale_product_assortment/readme/CONTRIBUTORS.md @@ -0,0 +1,9 @@ +- [Tecnativa](https://www.tecnativa.com): + + > - Carlos Roca + > - Pedro M. Baeza + > - Stefan Ungureanu + > - Pilar Vargas + +- [Ooops](https://www.ooops404.com): + - Ashish Hirpara () diff --git a/website_sale_product_assortment/readme/CONTRIBUTORS.rst b/website_sale_product_assortment/readme/CONTRIBUTORS.rst deleted file mode 100644 index 2de082face..0000000000 --- a/website_sale_product_assortment/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,9 +0,0 @@ -* `Tecnativa `_: - - * Carlos Roca - * Pedro M. Baeza - * Stefan Ungureanu - * Pilar Vargas - -* `Ooops `_: - * Ashish Hirpara (https://ashish-hirpara.com) diff --git a/website_sale_product_assortment/readme/DESCRIPTION.md b/website_sale_product_assortment/readme/DESCRIPTION.md new file mode 100644 index 0000000000..9c406c981f --- /dev/null +++ b/website_sale_product_assortment/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows to set e-commerce restrictions on product +assortments. diff --git a/website_sale_product_assortment/readme/DESCRIPTION.rst b/website_sale_product_assortment/readme/DESCRIPTION.rst deleted file mode 100644 index ffd0a25f89..0000000000 --- a/website_sale_product_assortment/readme/DESCRIPTION.rst +++ /dev/null @@ -1 +0,0 @@ -This module allows to set e-commerce restrictions on product assortments. diff --git a/website_sale_product_assortment/static/description/index.html b/website_sale_product_assortment/static/description/index.html index f993730aae..1223b23cd1 100644 --- a/website_sale_product_assortment/static/description/index.html +++ b/website_sale_product_assortment/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,8 +369,9 @@

eCommerce product assortment

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:2d8807010bb9fc649f45e174777ff7e9dd0d2843032901734194c53123809266 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

-

This module allows to set e-commerce restrictions on product assortments.

+

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

+

This module allows to set e-commerce restrictions on product +assortments.

Table of contents

    @@ -386,26 +387,27 @@

    eCommerce product assortment

Configuration

-

To see this module working, you have to define a product assortment and select -an option on the website availability field.

-

#. Don’t apply restriction: This option will not set any kind of restriction on -product items. -#. Avoid to show non available products: This option will hide on the e-commerce, the -products that are not added to the products domain. If a product template has at least -one allowed variant to show, the product will appear on the product items view but only -that variants will be able to be bought. -#. Avoid selling not available products: This option will restrict to buy the -products that are added to the assortment on the e-commerce. To inform the clients, -two more fields were added: “Message when unavailable” and “Assortment information”. -The first one will add a short description to the product item and the other one will set a -detailed description on the product sheet. This second one is editable from the website editor.

+

To see this module working, you have to define a product assortment and +select an option on the website availability field.

+

#. Don’t apply restriction: This option will not set any kind of +restriction on product items. #. Avoid to show non available +products: This option will hide on the e-commerce, the products that +are not added to the products domain. If a product template has at least +one allowed variant to show, the product will appear on the product +items view but only that variants will be able to be bought. #. Avoid +selling not available products: This option will restrict to buy the +products that are added to the assortment on the e-commerce. To inform +the clients, two more fields were added: “Message when unavailable” and +“Assortment information”. The first one will add a short description to +the product item and the other one will set a detailed description on +the product sheet. This second one is editable from the website editor.

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.

+feedback.

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

@@ -429,26 +431,25 @@

Contributors

-
  • -
    Ooops:
    -
    -
  • Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +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:

    CarlosRoca13

    -

    This module is part of the OCA/e-commerce project on GitHub.

    +

    This module is part of the OCA/e-commerce project on GitHub.

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

    diff --git a/website_sale_product_assortment/static/src/js/assortment_list_preview.js b/website_sale_product_assortment/static/src/js/assortment_list_preview.js index be239b0a3b..226b6f13fd 100644 --- a/website_sale_product_assortment/static/src/js/assortment_list_preview.js +++ b/website_sale_product_assortment/static/src/js/assortment_list_preview.js @@ -8,10 +8,8 @@ odoo.define("website_sale_product_assortment.assortment_preview", function (requ selector: "#products_grid", start: function () { - return $.when.apply($, [ - this._super.apply(this, arguments), - this.render_assortments(), - ]); + this._super.apply(this, arguments); + this.render_assortments(); }, render_assortments: function () { const $products = $(".o_wsale_product_grid_wrapper"); diff --git a/website_sale_product_assortment/static/src/js/variant_mixin.js b/website_sale_product_assortment/static/src/js/variant_mixin.js index a19961a47b..25094c3ad9 100644 --- a/website_sale_product_assortment/static/src/js/variant_mixin.js +++ b/website_sale_product_assortment/static/src/js/variant_mixin.js @@ -20,7 +20,7 @@ odoo.define("website_sale_product_assortment.VariantMixin", function (require) { const isMainProduct = combination.product_id && ($parent.is(".js_main_product") || $parent.is(".main_product")) && - combination.product_id === parseInt(product_id); + combination.product_id === parseInt(product_id, 10); if (!this.isWebsite || !isMainProduct) { return; }