[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) <rde@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
This commit is contained in:
Guillaume (gdi)
2023-07-24 10:14:25 +02:00
parent fb590c1dfe
commit 24f7849d77
2 changed files with 6 additions and 6 deletions
+4 -3
View File
@@ -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
@@ -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);