diff --git a/client/modules/crm/src/views/target-list/record/panels/relationship.js b/client/modules/crm/src/views/target-list/record/panels/relationship.js index e21ac5161a..939dd8c632 100644 --- a/client/modules/crm/src/views/target-list/record/panels/relationship.js +++ b/client/modules/crm/src/views/target-list/record/panels/relationship.js @@ -30,6 +30,8 @@ Espo.define('crm:views/target-list/record/panels/relationship', 'views/record/pa return Dep.extend({ + fetchOnModelAfterRelate: true, + actionOptOut: function (data) { if (confirm(this.translate('confirmation', 'messages'))) { $.ajax({ diff --git a/client/src/views/record/panels/relationship.js b/client/src/views/record/panels/relationship.js index d2400ecc7b..191c3bc861 100644 --- a/client/src/views/record/panels/relationship.js +++ b/client/src/views/record/panels/relationship.js @@ -40,6 +40,8 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', ' readOnly: false, + fetchOnModelAfterRelate: false, + init: function () { Dep.prototype.init.call(this); }, @@ -138,6 +140,12 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', ' this.setFilter(this.filter); + if (this.fetchOnModelAfterRelate) { + this.listenToOnce(this.model, 'after:relate', function () { + collection.fetch(); + }, this); + } + var viewName = this.defs.recordListView || this.getMetadata().get('clientDefs.' + this.scope + '.recordViews.list') || 'Record.List'; this.once('after:render', function () {