diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py
index 85e88859117..6031c575763 100644
--- a/addons/website/controllers/main.py
+++ b/addons/website/controllers/main.py
@@ -353,16 +353,6 @@ class Website(Home):
]
}
- @http.route('/website/get_modules_info', type='json', auth="user")
- def get_modules_info(self, xml_ids):
- def get_module_info(xml_id):
- module_info = request.env.ref(xml_id)
- return {'id': module_info.id, 'name': module_info.shortdesc}
- modules_info = {}
- for xml_id in xml_ids:
- modules_info[xml_id] = get_module_info(xml_id)
- return modules_info
-
@http.route('/website/snippet/filters', type='json', auth='public', website=True)
def get_dynamic_filter(self, filter_id, template_key, limit=None, search_domain=None, with_sample=False):
dynamic_filter = request.env['website.snippet.filter'].sudo().search(
diff --git a/addons/website/static/src/systray_items/new_content.js b/addons/website/static/src/systray_items/new_content.js
index 2951ed3481e..efebce9df6b 100644
--- a/addons/website/static/src/systray_items/new_content.js
+++ b/addons/website/static/src/systray_items/new_content.js
@@ -72,18 +72,21 @@ export class NewContentModal extends Component {
this.state = useState({
newContentElements: [
{
+ moduleName: 'website_blog',
moduleXmlId: 'base.module_website_blog',
status: MODULE_STATUS.NOT_INSTALLED,
icon: xml``,
title: this.env._t('Blog Post'),
},
{
+ moduleName: 'website_event',
moduleXmlId: 'base.module_website_event',
status: MODULE_STATUS.NOT_INSTALLED,
icon: xml``,
title: this.env._t('Event'),
},
{
+ moduleName: 'website_forum',
moduleXmlId: 'base.module_website_forum',
status: MODULE_STATUS.NOT_INSTALLED,
icon: xml``,
@@ -91,24 +94,28 @@ export class NewContentModal extends Component {
title: this.env._t('Forum'),
},
{
+ moduleName: 'website_hr_recruitment',
moduleXmlId: 'base.module_website_hr_recruitment',
status: MODULE_STATUS.NOT_INSTALLED,
icon: xml``,
title: this.env._t('Job Position'),
},
{
+ moduleName: 'website_sale',
moduleXmlId: 'base.module_website_sale',
status: MODULE_STATUS.NOT_INSTALLED,
icon: xml``,
title: this.env._t('Product'),
},
{
+ moduleName: 'website_slides',
moduleXmlId: 'base.module_website_slides',
status: MODULE_STATUS.NOT_INSTALLED,
icon: xml``,
title: this.env._t('Course'),
},
{
+ moduleName: 'website_livechat',
moduleXmlId: 'base.module_website_livechat',
status: MODULE_STATUS.NOT_INSTALLED,
icon: xml``,
@@ -131,10 +138,16 @@ export class NewContentModal extends Component {
async onWillStart() {
this.isDesigner = await this.user.hasGroup('website.group_website_designer');
this.canInstall = await this.user.isAdmin;
-
- const xmlIds = this.state.newContentElements.filter(({status}) => status === MODULE_STATUS.NOT_INSTALLED).map(({moduleXmlId}) => moduleXmlId);
if (this.canInstall) {
- this.modulesInfo = await this.rpc('/website/get_modules_info', {xml_ids: xmlIds});
+ const moduleNames = this.state.newContentElements.filter(({status}) => status === MODULE_STATUS.NOT_INSTALLED).map(({moduleName}) => moduleName);
+ this.modulesInfo = {};
+ for (const record of await this.orm.searchRead(
+ "ir.module.module",
+ [['name', 'in', moduleNames]],
+ ["id", "name", "shortdesc"],
+ )) {
+ this.modulesInfo[record.name] = {id: record.id, name: record.shortdesc};
+ }
}
}
@@ -169,7 +182,7 @@ export class NewContentModal extends Component {
return element.createNewContent();
}
- const {id, name} = this.modulesInfo[element.moduleXmlId];
+ const {id, name} = this.modulesInfo[element.moduleName];
const dialogProps = {
title: element.title,
installationText: _.str.sprintf(this.newContentText.installNeeded, name),