From 24f7849d779223e6810e0544a0a8ea7a582cf2c6 Mon Sep 17 00:00:00 2001 From: "Guillaume (gdi)" Date: Thu, 25 May 2023 15:20:46 +0000 Subject: [PATCH] [FIX] website: let default images if the industry is unknown Since [this commit], when the user configures a new website, he can set an unknown industry. Unfortunately, if he does so, by default, we set the industry to abbey, which is not very good for the default images the user will see and for internal IAP stats. This commit permits to use the new industry called Unknown, which is used for unidentified industries. When the industry is unknown, we leave the default theme images. [this commit]: https://github.com/odoo/odoo/commit/e82a1cb2ef1bcb413d99e7eb7521405d1d2e88d2 IAP PR: https://github.com/odoo/iap-apps/pull/635 task-3337894 closes odoo/odoo#129154 X-original-commit: 17dd3a84d9d9d42b04fde9aac708c032a472b13b Signed-off-by: Romain Derie (rde) Signed-off-by: Guillaume Dieleman (gdi) --- addons/website/models/website.py | 7 ++++--- .../static/src/client_actions/configurator/configurator.js | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 3a031afd75a..435ccd3339e 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -393,7 +393,7 @@ class Website(models.Model): client_themes = Module.search(domain).mapped('name') client_themes_img = {t: get_manifest(t).get('images_preview_theme', {}) for t in client_themes if get_manifest(t)} themes_suggested = self._website_api_rpc( - '/api/website/2/configurator/recommended_themes/%s' % industry_id, + '/api/website/2/configurator/recommended_themes/%s' % (industry_id if industry_id > 0 else ''), {'client_themes': client_themes_img} ) process_svg = self.env['website.configurator.feature']._process_svg @@ -644,9 +644,10 @@ class Website(models.Model): logger.warning(e) # Load suggestion from iap for selected pages + industry_id = kwargs['industry_id'] custom_resources = self._website_api_rpc( - '/api/website/2/configurator/custom_resources/%s' % kwargs['industry_id'], - {'theme': theme_name, } + '/api/website/2/configurator/custom_resources/%s' % (industry_id if industry_id > 0 else ''), + {'theme': theme_name} ) # Update pages diff --git a/addons/website/static/src/client_actions/configurator/configurator.js b/addons/website/static/src/client_actions/configurator/configurator.js index 6ff0a15cd05..6f35c252d01 100644 --- a/addons/website/static/src/client_actions/configurator/configurator.js +++ b/addons/website/static/src/client_actions/configurator/configurator.js @@ -123,9 +123,8 @@ class DescriptionScreen extends Component { _setSelectedIndustry(label) { this.industrySelection.el.parentNode.dataset.value = label; if (!this.autocompleteHasResults) { - // If no industry has been found, the first one is chosen by - // default to continue the website configuration. - this.state.selectIndustry(label, 1); + // Unknown industry. + this.state.selectIndustry(label, -1); } else { const id = this.labelToId[label]; this.state.selectIndustry(label, id);