From db801c8f6c90d708f6fe3fe456c5c6dcd7144983 Mon Sep 17 00:00:00 2001 From: Benjamin Willig Date: Mon, 4 Dec 2023 17:37:39 +0100 Subject: [PATCH] allow to delete the link with the current document --- cmis_web/i18n/fr.po | 14 ++++++++++++++ cmis_web/static/src/js/form_widgets.js | 18 ++++++++++++++++++ cmis_web/static/src/xml/form_widgets.xml | 9 ++++++--- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/cmis_web/i18n/fr.po b/cmis_web/i18n/fr.po index 397ced3e..d74bf437 100644 --- a/cmis_web/i18n/fr.po +++ b/cmis_web/i18n/fr.po @@ -309,6 +309,13 @@ msgstr "Couper" msgid "Delete" msgstr "Supprimer" +#. module: cmis_web +#. openerp-web +#: code:addons/cmis_web/static/src/xml/form_widgets.xml:0 +#, python-format +msgid "Delete link" +msgstr "Supprimer le lien" + #. module: cmis_web #. openerp-web #: code:addons/cmis_web/static/src/xml/form_widgets.xml:0 @@ -559,6 +566,13 @@ msgstr "" msgid "No matching records found" msgstr "Aucune donnée disponible" +#. module: cmis_web +#. openerp-web +#: code:addons/cmis_web/static/src/xml/form_widgets.xml:0 +#, python-format +msgid "Note : the search query is case sensitive." +msgstr "Note : la requête de recherche est sensible aux minuscules/majuscules" + #. 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 36086d3c..bacd57e1 100644 --- a/cmis_web/static/src/js/form_widgets.js +++ b/cmis_web/static/src/js/form_widgets.js @@ -1359,6 +1359,20 @@ odoo.define('cmis_web.form_widgets', function (require) { } }, + on_click_delete_link: function () { + let self = this; + let values = {}; + values[this.name] = false; + this._rpc({ + model: this.model, + method: "write", + args: [this.res_id, values], + }).then(function() { + self.value = "empty"; + self._render(); + }); + }, + on_cancel_checkout: function (e) { var self = this; this._cancel_checkout().finally(() => self.trigger_up('reload')); @@ -1442,6 +1456,10 @@ odoo.define('cmis_web.form_widgets', function (require) { self.stopEvent(e); self.on_cancel_checkout(); }); + $el_actions.find('.content-action-delete-link').on('click', function(e) { + self.stopEvent(e); + self.on_click_delete_link(); + }) }, register_no_document: function () { diff --git a/cmis_web/static/src/xml/form_widgets.xml b/cmis_web/static/src/xml/form_widgets.xml index 4c80193e..1e3a4507 100644 --- a/cmis_web/static/src/xml/form_widgets.xml +++ b/cmis_web/static/src/xml/form_widgets.xml @@ -361,7 +361,7 @@