Skip to content

Commit

Permalink
[ADD] allow to delete the link with the current document
Browse files Browse the repository at this point in the history
  • Loading branch information
benwillig committed Dec 4, 2023
1 parent 086b050 commit 8081823
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
14 changes: 14 additions & 0 deletions cmis_web/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions cmis_web/static/src/js/form_widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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 () {
Expand Down
9 changes: 6 additions & 3 deletions cmis_web/static/src/xml/form_widgets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@

<t t-name='CmisLinkDocumentDialog'>
<form class="form-horizontal cmis_link_document" role="form">
<div class="form-group">
<div class="form-group" name="identifier">
<div class="col-sm-12">
<div class="input-group">
<span class="input-group-text col-sm-8">
Expand All @@ -378,13 +378,15 @@
<span class="input-group-text">
<label for="search">Search based on document name</label>
</span>

</div>
<input class="ml-1 form-control search-input" type="text"/>
<input class="ml-1 form-control search-input" type="text"/>
<div class="input-group-append">
<button class="btn btn-outline-secondary btn-search" type="button"><i class="fa fa-search"/>Search</button>
</div>
</div>
<p class="text-muted">
Note : the search query is case sensitive.
</p>
</div>
<div class="col-sm-12 document-list">

Expand Down Expand Up @@ -600,6 +602,7 @@
<li t-if='canGetProperties'><a class='content-action-get-properties' href="#">View Details</a></li>
<li t-if='canUpdateProperties'><a class='content-action-rename' href="#">Rename</a></li>
<li t-if='canUpdateProperties'><a class='content-action-checkin' href="#">Import new version</a></li>
<li t-if='canUpdateProperties'><a class='content-action-delete-link' href="#">Delete link</a></li>
<li t-if="canGetContentStream"><a class='content-action-history' href="#">Show document history</a></li>
<li t-if='object.isCheckedOut' role="separator" class="divider"></li>
<li t-if='object.isCheckedOut'><a class='content-action-cancel-checkout' href="#">Cancel checkout</a></li>
Expand Down

0 comments on commit 8081823

Please sign in to comment.