EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
remove related from list related
Yuri Kuznetsovb465faf93610
diff --git a/client/src/views/list-related.js b/client/src/views/list-related.jsindex 6c9740631b..749fad9ec5 100644--- a/client/src/views/list-related.js+++ b/client/src/views/list-related.js@@ -272,6 +272,7 @@ class ListRelatedView extends MainView {);this.addActionHandler('fullRefresh', () => this.actionFullRefresh());+ this.addActionHandler('removeRelated', () => this.actionRemoveRelated());}/**@@ -833,6 +834,37 @@ class ListRelatedView extends MainView {Espo.Ui.notify();}++ /**+ * @protected+ * @param {{id: string}} data+ * @return {Promise<void>}+ */+ async actionRemoveRelated(data) {+ const id = data.id;++ await this.confirm({+ message: this.translate('removeRecordConfirmation', 'messages'),+ confirmText: this.translate('Remove'),+ });++ const model = this.collection.get(id);++ if (!model) {+ return;+ }++ Espo.Ui.notifyWait();++ await model.destroy();++ Espo.Ui.success(this.translate('Removed'));++ this.collection.fetch().then(() => {});++ this.model.trigger('after:unrelate');+ this.model.trigger(`after:unrelate:${this.link}`);+ }}export default ListRelatedView;