From d5e67693122e9a7ec2e4b9b910e63f3457d3401e Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 7 Aug 2020 10:13:45 +0100 Subject: [PATCH 01/28] [ADD] website_sale_b2x_alt_price: display B2{B,C} complementary price - If your website is B2B, display a smaller B2C price next to the main one. And viceversa. - Toggle feature independently in list and product templates. - Toggle feature per website. - Supports live price recomputing. @Tecnativa TT24410 --- website_sale_b2x_alt_price/README.rst | 137 +++++ website_sale_b2x_alt_price/__init__.py | 1 + website_sale_b2x_alt_price/__manifest__.py | 25 + website_sale_b2x_alt_price/demo/assets.xml | 17 + website_sale_b2x_alt_price/i18n/es.po | 33 ++ .../i18n/website_sale_b2x_alt_price.pot | 30 ++ website_sale_b2x_alt_price/models/__init__.py | 1 + .../models/product_template.py | 78 +++ .../readme/CONFIGURE.rst | 12 + .../readme/CONTRIBUTORS.rst | 2 + .../readme/DESCRIPTION.rst | 20 + website_sale_b2x_alt_price/readme/ROADMAP.rst | 6 + website_sale_b2x_alt_price/readme/USAGE.rst | 6 + .../static/description/b2b-features.png | Bin 0 -> 167708 bytes .../static/description/b2c-features.png | Bin 0 -> 162355 bytes .../static/description/details-features.gif | Bin 0 -> 173164 bytes .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 476 ++++++++++++++++++ .../static/description/toggle-detail.gif | Bin 0 -> 527910 bytes .../static/description/toggle-list.gif | Bin 0 -> 402874 bytes .../src/js/product_configurator_mixin.js | 57 +++ .../static/tours/b2b.js | 137 +++++ .../static/tours/b2c.js | 120 +++++ .../templates/assets.xml | 14 + .../templates/product.xml | 28 ++ website_sale_b2x_alt_price/tests/__init__.py | 1 + website_sale_b2x_alt_price/tests/test_ui.py | 174 +++++++ 27 files changed, 1375 insertions(+) create mode 100644 website_sale_b2x_alt_price/README.rst create mode 100644 website_sale_b2x_alt_price/__init__.py create mode 100644 website_sale_b2x_alt_price/__manifest__.py create mode 100644 website_sale_b2x_alt_price/demo/assets.xml create mode 100644 website_sale_b2x_alt_price/i18n/es.po create mode 100644 website_sale_b2x_alt_price/i18n/website_sale_b2x_alt_price.pot create mode 100644 website_sale_b2x_alt_price/models/__init__.py create mode 100644 website_sale_b2x_alt_price/models/product_template.py create mode 100644 website_sale_b2x_alt_price/readme/CONFIGURE.rst create mode 100644 website_sale_b2x_alt_price/readme/CONTRIBUTORS.rst create mode 100644 website_sale_b2x_alt_price/readme/DESCRIPTION.rst create mode 100644 website_sale_b2x_alt_price/readme/ROADMAP.rst create mode 100644 website_sale_b2x_alt_price/readme/USAGE.rst create mode 100644 website_sale_b2x_alt_price/static/description/b2b-features.png create mode 100644 website_sale_b2x_alt_price/static/description/b2c-features.png create mode 100644 website_sale_b2x_alt_price/static/description/details-features.gif create mode 100644 website_sale_b2x_alt_price/static/description/icon.png create mode 100644 website_sale_b2x_alt_price/static/description/index.html create mode 100644 website_sale_b2x_alt_price/static/description/toggle-detail.gif create mode 100644 website_sale_b2x_alt_price/static/description/toggle-list.gif create mode 100644 website_sale_b2x_alt_price/static/src/js/product_configurator_mixin.js create mode 100644 website_sale_b2x_alt_price/static/tours/b2b.js create mode 100644 website_sale_b2x_alt_price/static/tours/b2c.js create mode 100644 website_sale_b2x_alt_price/templates/assets.xml create mode 100644 website_sale_b2x_alt_price/templates/product.xml create mode 100644 website_sale_b2x_alt_price/tests/__init__.py create mode 100644 website_sale_b2x_alt_price/tests/test_ui.py diff --git a/website_sale_b2x_alt_price/README.rst b/website_sale_b2x_alt_price/README.rst new file mode 100644 index 0000000000..b4fc6b7dc9 --- /dev/null +++ b/website_sale_b2x_alt_price/README.rst @@ -0,0 +1,137 @@ +================================================= +Alternative (un)taxed prices display on eCommerce +================================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-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/12.0/website_sale_b2x_alt_price + :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-12-0/e-commerce-12-0-website_sale_b2x_alt_price + :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/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module takes into account if your eCommerce is in B2B or B2C mode, and +displays the alternative pricing next to the main one. + +For example, if your website is B2B (main price is without taxes), you would +see it similar to this: + +.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/12.0/website_sale_b2x_alt_price/static/description/b2b-features.png + :alt: B2B features showcase + +If your website is B2C (main price is with taxes), then it looks like this: + +.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/12.0/website_sale_b2x_alt_price/static/description/b2c-features.png + :alt: B2C features showcase + +It also displays the alternative price, including discounts, updated +automatically when the user is choosing alternatives in the product detail +page: + +.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/12.0/website_sale_b2x_alt_price/static/description/details-features.gif + :alt: Product details page features showcase + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To choose if you want to display or not the alternative price in the website +products list, just enable or disable the feature from the "Customize" menu. +This can be done independently per website: + +.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/12.0/website_sale_b2x_alt_price/static/description/toggle-list.gif + :alt: How to disable and enable the feature in products list + +You can also toggle the behavior similarly in the product details page. +This can also be done independently per website: + +.. figure:: https://raw.githubusercontent.com/OCA/e-commerce/12.0/website_sale_b2x_alt_price/static/description/toggle-detail.gif + :alt: How to disable and enable the feature in product details + +Usage +===== + +To use this module, you need to: + +#. Create a product. +#. Set some customer taxes on it. +#. Publish it. +#. Go see it on your website. It will display the alternative price. + +Known issues / Roadmap +====================== + +* Computing this requires 1 or 2 extra calls to ``taxes.compute_all()`` per + product. This could be expensive in terms of performance, but the truth is + that it is also not very optimized upstream in Odoo. Maybe optimize this part + in Odoo and in this module? Or maybe apply some hack to avoid recomputing + this? Maybe cache calls to that method? Is it really a problem in the + Real World®? + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `__: + * Jairo Llopis + +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-Yajo| image:: https://github.com/Yajo.png?size=40px + :target: https://github.com/Yajo + :alt: Yajo + +Current `maintainer `__: + +|maintainer-Yajo| + +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_b2x_alt_price/__init__.py b/website_sale_b2x_alt_price/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_sale_b2x_alt_price/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_sale_b2x_alt_price/__manifest__.py b/website_sale_b2x_alt_price/__manifest__.py new file mode 100644 index 0000000000..308e152f40 --- /dev/null +++ b/website_sale_b2x_alt_price/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2020 Jairo Llopis - Tecnativa +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +{ + "name": "Alternative (un)taxed prices display on eCommerce", + "summary": "Display prices with(out) taxes in eCommerce, complementing normal mode", + "version": "12.0.1.0.0", + "development_status": "Beta", + "category": "Website", + "website": "https://github.com/OCA/e-commerce", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["Yajo"], + "license": "LGPL-3", + "application": False, + "installable": True, + "depends": [ + "website_sale", + ], + "data": [ + "templates/assets.xml", + "templates/product.xml", + ], + "demo": [ + "demo/assets.xml", + ], +} diff --git a/website_sale_b2x_alt_price/demo/assets.xml b/website_sale_b2x_alt_price/demo/assets.xml new file mode 100644 index 0000000000..e6094c9f2e --- /dev/null +++ b/website_sale_b2x_alt_price/demo/assets.xml @@ -0,0 +1,17 @@ + + + + + + +