diff --git a/setup/website_sale_attribute_filter_form_submit/odoo/addons/website_sale_attribute_filter_form_submit b/setup/website_sale_attribute_filter_form_submit/odoo/addons/website_sale_attribute_filter_form_submit new file mode 120000 index 0000000000..7fe2fdd41f --- /dev/null +++ b/setup/website_sale_attribute_filter_form_submit/odoo/addons/website_sale_attribute_filter_form_submit @@ -0,0 +1 @@ +../../../../website_sale_attribute_filter_form_submit \ No newline at end of file diff --git a/setup/website_sale_attribute_filter_form_submit/setup.py b/setup/website_sale_attribute_filter_form_submit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/website_sale_attribute_filter_form_submit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_sale_attribute_filter_form_submit/README.rst b/website_sale_attribute_filter_form_submit/README.rst new file mode 100644 index 0000000000..d005d6024f --- /dev/null +++ b/website_sale_attribute_filter_form_submit/README.rst @@ -0,0 +1,104 @@ +================================ +Website manual attribute filters +================================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-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%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/14.0/website_sale_attribute_filter_form_submit + :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-14-0/e-commerce-14-0-website_sale_attribute_filter_form_submit + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/113/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to configure the website filters in an no automatic way, so the +filters aren't applied until the user explicitly validate them. It can be set on +any needed website. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +#. Go to the frontend /shop url of the website you want to set the manual filters into. +#. Hit the Configure menu and enable the option *Manual filters*. + +.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/14.0/website_sale_attribute_filter_form_submit/static/description/manual_filter_configuration.png + :alt: To enable the manual filters + :width: 600 px + +Usage +===== + +When manual filter are active, the user can set as many filters as desired and then +hit the submit button to apply them. This allows to set several filters at once, which +isn't always possible with the automatic behavior. + +.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/14.0/website_sale_attribute_filter_form_submit/static/description/manual_filter_usage.gif + :alt: To enable the manual filters + :width: 600 px + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Studio73 +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Studio73 `_: + + * Miguel Gandia +* `Tecnativa `_: + + * David Vidal + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_attribute_filter_form_submit/__init__.py b/website_sale_attribute_filter_form_submit/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website_sale_attribute_filter_form_submit/__manifest__.py b/website_sale_attribute_filter_form_submit/__manifest__.py new file mode 100644 index 0000000000..824631d1e6 --- /dev/null +++ b/website_sale_attribute_filter_form_submit/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2021 Studio73 - Miguel Gandia +# Copyright 2021 Tecnativa - David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Website manual attribute filters", + "version": "15.0.1.0.0", + "category": "E-Commerce", + "summary": "Allow to apply manually the filters on the e-commerce", + "license": "AGPL-3", + "depends": ["website_sale"], + "data": [ + "views/website_sale.xml", + ], + "assets": { + "web.assets_frontend": [ + "website_sale_attribute_filter_form_submit/static/src/js/website_sale.js" + ], + }, + "author": "Studio73, Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/e-commerce", + "installable": True, +} diff --git a/website_sale_attribute_filter_form_submit/i18n/es.po b/website_sale_attribute_filter_form_submit/i18n/es.po new file mode 100644 index 0000000000..2c1088f8c5 --- /dev/null +++ b/website_sale_attribute_filter_form_submit/i18n/es.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_attribute_filter_form_submit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-10 15:58+0000\n" +"PO-Revision-Date: 2021-05-10 15:58+0000\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_attribute_filter_form_submit +#: model_terms:ir.ui.view,arch_db:website_sale_attribute_filter_form_submit.products_attributes_filter_manual +msgid "Apply" +msgstr "Aplicar" diff --git a/website_sale_attribute_filter_form_submit/i18n/website_sale_attribute_filter_form_submit.pot b/website_sale_attribute_filter_form_submit/i18n/website_sale_attribute_filter_form_submit.pot new file mode 100644 index 0000000000..63b61d604d --- /dev/null +++ b/website_sale_attribute_filter_form_submit/i18n/website_sale_attribute_filter_form_submit.pot @@ -0,0 +1,19 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_attribute_filter_form_submit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_attribute_filter_form_submit +#: model_terms:ir.ui.view,arch_db:website_sale_attribute_filter_form_submit.products_attributes_filter_manual +msgid "Apply" +msgstr "" diff --git a/website_sale_attribute_filter_form_submit/readme/CONFIGURE.rst b/website_sale_attribute_filter_form_submit/readme/CONFIGURE.rst new file mode 100644 index 0000000000..84f61d4236 --- /dev/null +++ b/website_sale_attribute_filter_form_submit/readme/CONFIGURE.rst @@ -0,0 +1,8 @@ +To configure this module, you need to: + +#. Go to the frontend /shop url of the website you want to set the manual filters into. +#. Hit the Configure menu and enable the option *Manual filters*. + +.. figure:: ../static/description/manual_filter_configuration.png + :alt: To enable the manual filters + :width: 600 px diff --git a/website_sale_attribute_filter_form_submit/readme/CONTRIBUTORS.rst b/website_sale_attribute_filter_form_submit/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..3a392bc59c --- /dev/null +++ b/website_sale_attribute_filter_form_submit/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* `Studio73 `_: + + * Miguel Gandia +* `Tecnativa `_: + + * David Vidal diff --git a/website_sale_attribute_filter_form_submit/readme/DESCRIPTION.rst b/website_sale_attribute_filter_form_submit/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..bc7385bd51 --- /dev/null +++ b/website_sale_attribute_filter_form_submit/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows to configure the website filters in an no automatic way, so the +filters aren't applied until the user explicitly validate them. It can be set on +any needed website. diff --git a/website_sale_attribute_filter_form_submit/readme/USAGE.rst b/website_sale_attribute_filter_form_submit/readme/USAGE.rst new file mode 100644 index 0000000000..fa678d0e08 --- /dev/null +++ b/website_sale_attribute_filter_form_submit/readme/USAGE.rst @@ -0,0 +1,7 @@ +When manual filter are active, the user can set as many filters as desired and then +hit the submit button to apply them. This allows to set several filters at once, which +isn't always possible with the automatic behavior. + +.. figure:: ../static/description/manual_filter_usage.gif + :alt: To enable the manual filters + :width: 600 px diff --git a/website_sale_attribute_filter_form_submit/static/description/icon.png b/website_sale_attribute_filter_form_submit/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/website_sale_attribute_filter_form_submit/static/description/icon.png differ diff --git a/website_sale_attribute_filter_form_submit/static/description/index.html b/website_sale_attribute_filter_form_submit/static/description/index.html new file mode 100644 index 0000000000..9d954a7dc1 --- /dev/null +++ b/website_sale_attribute_filter_form_submit/static/description/index.html @@ -0,0 +1,457 @@ + + + + + + +Website manual attribute filters + + + +
+

Website manual attribute filters

+ + +

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

+

This module allows to configure the website filters in an no automatic way, so the +filters aren’t applied until the user explicitly validate them. It can be set on +any needed website.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to the frontend /shop url of the website you want to set the manual filters into.
  2. +
  3. Hit the Configure menu and enable the option Manual filters.
  4. +
+
+To enable the manual filters +
+
+
+

Usage

+

When manual filter are active, the user can set as many filters as desired and then +hit the submit button to apply them. This allows to set several filters at once, which +isn’t always possible with the automatic behavior.

+
+To enable the manual filters +
+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Studio73
  • +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

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.

+

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_attribute_filter_form_submit/static/description/manual_filter_configuration.png b/website_sale_attribute_filter_form_submit/static/description/manual_filter_configuration.png new file mode 100644 index 0000000000..ec7bfb6184 Binary files /dev/null and b/website_sale_attribute_filter_form_submit/static/description/manual_filter_configuration.png differ diff --git a/website_sale_attribute_filter_form_submit/static/description/manual_filter_usage.gif b/website_sale_attribute_filter_form_submit/static/description/manual_filter_usage.gif new file mode 100644 index 0000000000..d540efab72 Binary files /dev/null and b/website_sale_attribute_filter_form_submit/static/description/manual_filter_usage.gif differ diff --git a/website_sale_attribute_filter_form_submit/static/src/js/website_sale.js b/website_sale_attribute_filter_form_submit/static/src/js/website_sale.js new file mode 100644 index 0000000000..b2042a1fd6 --- /dev/null +++ b/website_sale_attribute_filter_form_submit/static/src/js/website_sale.js @@ -0,0 +1,48 @@ +// Copyright 2021 Tecnativa - David Vidal +// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +odoo.define( + "website_sale_attribute_filter_form_submit.website_sale", + function (require) { + "use strict"; + + require("website_sale.website_sale"); + var sAnimations = require("website.content.snippets.animation"); + + sAnimations.registry.WebsiteSale.include({ + read_events: _.extend( + { + "change .css_attribute_color input": "_onChangeColorAttribute", + }, + sAnimations.registry.WebsiteSale.prototype.read_events + ), + /** + * Highlight selected color as we prevent form submit we need to have + * a visual feedback on color change. + * + * @private + * @param {MouseEvent} ev + */ + _onChangeColorAttribute: function (ev) { + var $parent = $(ev.target).closest(".js_attributes"); + $parent + .find(".css_attribute_color") + .removeClass("active") + .filter(":has(input:checked)") + .addClass("active"); + }, + /** + * When the view is active, we deactivate the auto submit + * + * @private + * @param {MouseEvent} ev + */ + _onChangeAttribute: function (ev) { + var manual = $(ev.target).closest(".js_attributes_manual"); + if (manual.length) { + return true; + } + this._super.apply(this, arguments); + }, + }); + } +); diff --git a/website_sale_attribute_filter_form_submit/views/website_sale.xml b/website_sale_attribute_filter_form_submit/views/website_sale.xml new file mode 100644 index 0000000000..14f656a79f --- /dev/null +++ b/website_sale_attribute_filter_form_submit/views/website_sale.xml @@ -0,0 +1,31 @@ + + + + +