From 0f3ea5e1f4cc5951bbd238f1f2302f9800e0a69e Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Fri, 13 Aug 2021 08:10:30 +0000 Subject: [PATCH] [FIX] website: allow edit robots.txt to non-first website Previous implementation always updated *current website*, which is not always the same as the value from `res.config.settings`. --- opw-2623007 X-original-commit: d66d44db031be76403ce7c01616e334ef196fd03 --- addons/website/models/res_config_settings.py | 1 + addons/website/static/src/js/backend/res_config_settings.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/addons/website/models/res_config_settings.py b/addons/website/models/res_config_settings.py index e509d237a66..9501ab5cf15 100644 --- a/addons/website/models/res_config_settings.py +++ b/addons/website/models/res_config_settings.py @@ -168,6 +168,7 @@ class ResConfigSettings(models.TransientModel): } def action_open_robots(self): + self.website_id._force() return { 'name': _("Robots.txt"), 'view_mode': 'form', diff --git a/addons/website/static/src/js/backend/res_config_settings.js b/addons/website/static/src/js/backend/res_config_settings.js index 80f6f21418c..2ebee758abc 100644 --- a/addons/website/static/src/js/backend/res_config_settings.js +++ b/addons/website/static/src/js/backend/res_config_settings.js @@ -24,6 +24,9 @@ BaseSettingController.include({ * Without this override, it is impossible to go to a website other than the * first because discarding will revert it back to the default value. * + * Without this override, it is impossible to edit robots.txt website other than the + * first because discarding will revert it back to the default value. + * * Without this override, it is impossible to install a theme on a website * other than the first because discarding will revert it back to the * default value. @@ -32,6 +35,7 @@ BaseSettingController.include({ */ _onButtonClicked: function (ev) { if (ev.data.attrs.name === 'website_go_to' + || ev.data.attrs.name === 'action_open_robots' || ev.data.attrs.name === 'install_theme_on_current_website') { FormController.prototype._onButtonClicked.apply(this, arguments); } else {