From c13fdc39f53fe3d3d4fe70cbe401f7f4c6864ed2 Mon Sep 17 00:00:00 2001 From: Simone Rubino Date: Mon, 15 Jan 2024 12:59:59 +0100 Subject: [PATCH] [MIG] website_product_configurator: Migration to 16.0 --- website_product_configurator/README.rst | 86 ++++ website_product_configurator/__init__.py | 1 - website_product_configurator/__manifest__.py | 16 +- .../controllers/main.py | 7 +- .../data/config_form_templates.xml | 135 +++--- .../data/ir_config_parameter_data.xml | 19 +- .../demo/product_template_demo.xml | 2 - .../models/__init__.py | 1 + .../models/product_config.py | 2 +- .../models/product_template.py | 60 +++ .../models/res_config_settings.py | 5 +- .../models/sale_order.py | 244 ++-------- .../readme/CONTRIBUTORS.rst | 3 + .../{README.md => readme/DESCRIPTION.rst} | 2 - .../security/configurator_security.xml | 26 +- .../static/description/index.html | 425 ++++++++++++++++++ .../static/src/js/config_form.js | 3 +- .../static/src/js/variant_mixin.js | 16 + .../static/src/js/website_sale.esm.js | 17 + .../static/src/js/website_sale.js | 55 --- .../static/tests/tours/custom_values.esm.js | 115 +++++ .../tests/__init__.py | 1 + .../tests/test_custom_values.py | 59 +++ .../tests/test_sale_order.py | 63 +-- ...est_website_product_configurator_values.py | 6 +- website_product_configurator/views/assets.xml | 35 -- .../views/product_view.xml | 14 +- .../views/res_config_settings_view.xml | 72 ++- 28 files changed, 1018 insertions(+), 472 deletions(-) create mode 100644 website_product_configurator/README.rst create mode 100644 website_product_configurator/models/product_template.py create mode 100644 website_product_configurator/readme/CONTRIBUTORS.rst rename website_product_configurator/{README.md => readme/DESCRIPTION.rst} (67%) create mode 100644 website_product_configurator/static/description/index.html create mode 100644 website_product_configurator/static/src/js/variant_mixin.js create mode 100644 website_product_configurator/static/src/js/website_sale.esm.js delete mode 100644 website_product_configurator/static/src/js/website_sale.js create mode 100644 website_product_configurator/static/tests/tours/custom_values.esm.js create mode 100644 website_product_configurator/tests/test_custom_values.py delete mode 100644 website_product_configurator/views/assets.xml diff --git a/website_product_configurator/README.rst b/website_product_configurator/README.rst new file mode 100644 index 0000000000..09f1bfe434 --- /dev/null +++ b/website_product_configurator/README.rst @@ -0,0 +1,86 @@ +============================ +Website Product Configurator +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:571a6836c9659722dc42db79a4b0b1d7f1915bf9c139a7a34518f21973cdc009 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fproduct--configurator-lightgray.png?logo=github + :target: https://github.com/OCA/product-configurator/tree/16.0/website_product_configurator + :alt: OCA/product-configurator +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-configurator-16-0/product-configurator-16-0-website_product_configurator + :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/product-configurator&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module facilitates to configure product on website. + +**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 +~~~~~~~ + +* Pledra + +Contributors +~~~~~~~~~~~~ + +* `Aion Tech `_: + + * Simone Rubino + +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-PCatinean| image:: https://github.com/PCatinean.png?size=40px + :target: https://github.com/PCatinean + :alt: PCatinean + +Current `maintainer `__: + +|maintainer-PCatinean| + +This module is part of the `OCA/product-configurator `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_product_configurator/__init__.py b/website_product_configurator/__init__.py index 5a9543a4b8..f7209b1710 100644 --- a/website_product_configurator/__init__.py +++ b/website_product_configurator/__init__.py @@ -1,3 +1,2 @@ from . import models from . import controllers -from . import tests diff --git a/website_product_configurator/__manifest__.py b/website_product_configurator/__manifest__.py index 3e50eb258e..29a6890ac4 100644 --- a/website_product_configurator/__manifest__.py +++ b/website_product_configurator/__manifest__.py @@ -1,6 +1,6 @@ { "name": "Website Product Configurator", - "version": "14.0.1.2.0", + "version": "16.0.1.0.0", "summary": """Configure products in e-shop""", "author": "Pledra, Odoo Community Association (OCA)", "license": "AGPL-3", @@ -16,11 +16,23 @@ "data/ir_config_parameter_data.xml", "data/config_form_templates.xml", "data/cron.xml", - "views/assets.xml", "views/product_view.xml", "views/templates.xml", "views/res_config_settings_view.xml", ], + "assets": { + "web.assets_frontend": [ + "website_product_configurator/static/src/js/config_form.js", + "website_product_configurator/static/src/js/variant_mixin.js", + "website_product_configurator/static/src/js/website_sale.esm.js", + "website_product_configurator/static/src/js/website_config_tour.js", + "website_product_configurator/static/src/scss/config_form.scss", + "website_product_configurator/static/src/scss/tooltip.scss", + ], + "web.assets_tests": [ + "website_product_configurator/static/tests/tours/custom_values.esm.js", + ], + }, "demo": ["demo/product_template_demo.xml"], "images": ["static/description/cover.png"], "application": True, diff --git a/website_product_configurator/controllers/main.py b/website_product_configurator/controllers/main.py index eb9eb464ca..2d72029465 100644 --- a/website_product_configurator/controllers/main.py +++ b/website_product_configurator/controllers/main.py @@ -1,4 +1,5 @@ import json +import logging from odoo import http, models from odoo.exceptions import UserError, ValidationError @@ -8,6 +9,8 @@ from odoo.addons.http_routing.models.ir_http import slug from odoo.addons.website_sale.controllers.main import WebsiteSale +_logger = logging.getLogger(__name__) + def get_pricelist(): sale_order = request.env.context.get("sale_order") @@ -467,8 +470,8 @@ def save_configuration( valid = config_session_id.sudo().validate_configuration() if valid: check_next_step = False - except Exception: - pass + except Exception as exc: + _logger.debug(exc, exc_info=True) if check_next_step: result = self.set_config_next_step( config_session_id=config_session_id, diff --git a/website_product_configurator/data/config_form_templates.xml b/website_product_configurator/data/config_form_templates.xml index 9fbdacf12a..607bc289b3 100644 --- a/website_product_configurator/data/config_form_templates.xml +++ b/website_product_configurator/data/config_form_templates.xml @@ -18,14 +18,13 @@ - -