From b248e49a7701a413d07cc54cf0eb7b73a2474fe2 Mon Sep 17 00:00:00 2001 From: Benjamin Willig Date: Tue, 19 Dec 2023 11:35:54 +0100 Subject: [PATCH] [ADD] added message when there is no source folder to search in to prevent a stacktrace --- cmis_web/i18n/cmis_web.pot | 7 +++++++ cmis_web/i18n/fr.po | 7 +++++++ cmis_web/static/src/js/form_widgets.js | 5 ++++- cmis_web/static/src/xml/form_widgets.xml | 7 +++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cmis_web/i18n/cmis_web.pot b/cmis_web/i18n/cmis_web.pot index 69fc7aab..fe9b69a7 100644 --- a/cmis_web/i18n/cmis_web.pot +++ b/cmis_web/i18n/cmis_web.pot @@ -573,6 +573,13 @@ msgstr "" msgid "Note : the search query is case sensitive." msgstr "" +#. module: cmis_web +#. openerp-web +#: code:addons/cmis_web/static/src/xml/form_widgets.xml:0 +#, python-format +msgid "Note : the search tool can't be used because current record has no CMIS folder." +msgstr "" + #. module: cmis_web #. openerp-web #: code:addons/cmis_web/static/src/js/form_widgets.js:0 diff --git a/cmis_web/i18n/fr.po b/cmis_web/i18n/fr.po index 991a903f..f9092134 100644 --- a/cmis_web/i18n/fr.po +++ b/cmis_web/i18n/fr.po @@ -573,6 +573,13 @@ msgstr "Aucune donnée disponible" msgid "Note : the search query is case sensitive." msgstr "Remarque : la recherche est sensible aux minuscules et majuscules" +#. module: cmis_web +#. openerp-web +#: code:addons/cmis_web/static/src/xml/form_widgets.xml:0 +#, python-format +msgid "Note : the search tool can't be used because current record has no CMIS folder." +msgstr "Remarque : la recherche n'est pas utilisable car l'enregistrement courant n'a pas de dossier CMIS." + #. module: cmis_web #. openerp-web #: code:addons/cmis_web/static/src/js/form_widgets.js:0 diff --git a/cmis_web/static/src/js/form_widgets.js b/cmis_web/static/src/js/form_widgets.js index bacd57e1..cffc75c8 100644 --- a/cmis_web/static/src/js/form_widgets.js +++ b/cmis_web/static/src/js/form_widgets.js @@ -422,9 +422,12 @@ odoo.define('cmis_web.form_widgets', function (require) { on_click_search: function (e) { let self = this; + if (!self.search_enabled) { + return false; + } let $input = self.$search_input; let search_value = $input.val(); - if (search_value.length === 1) { + if (search_value !== undefined && search_value.length === 1) { alert(_t( "The search criteria should at least contains 2 characters. " + "Or empty if you want to see all documents." diff --git a/cmis_web/static/src/xml/form_widgets.xml b/cmis_web/static/src/xml/form_widgets.xml index 1e3a4507..b3e6c8b3 100644 --- a/cmis_web/static/src/xml/form_widgets.xml +++ b/cmis_web/static/src/xml/form_widgets.xml @@ -392,6 +392,13 @@ +
+
+

+ Note : the search tool can't be used because current record has no CMIS folder. +

+
+