Skip to content

EspoCRM – Open Source CRM Application

ref

Yuri Kuznetsov1bcb8349deb2
diff --git a/client/src/views/fields/link-multiple.js b/client/src/views/fields/link-multiple.js
index 2bdbc4d98d..8ff91511f1 100644
--- a/client/src/views/fields/link-multiple.js
+++ b/client/src/views/fields/link-multiple.js
@@ -1221,28 +1221,19 @@ class LinkMultipleFieldView extends BaseFieldView {
});
}
- actionCreateLink() {
- const viewName = this.getMetadata().get(['clientDefs', this.foreignScope, 'modalViews', 'edit']) ||
- 'views/modals/edit';
+ /**
+ * @protected
+ */
+ async actionCreateLink() {
+ const helper = new RecordModal();
- Espo.Ui.notifyWait();
+ const attributes = await this.getCreateAttributesProvider()();
- this.getCreateAttributesProvider()().then(attributes => {
- this.createView('dialog', viewName, {
- scope: this.foreignScope,
- fullFormDisabled: true,
- attributes: attributes,
- }, view => {
- view.render()
- .then(() => Espo.Ui.notify(false));
-
- this.listenToOnce(view, 'after:save', model => {
- view.close();
- this.clearView('dialog');
-
- this.select([model]);
- });
- });
+ await helper.showCreate(this, {
+ entityType: this.foreignScope,
+ fullFormDisabled: true,
+ attributes: attributes,
+ afterSave: model => this.select([model]),
});
}
diff --git a/client/src/views/fields/link.js b/client/src/views/fields/link.js
index 3db0b96d1b..8f57e7fa60 100644
--- a/client/src/views/fields/link.js
+++ b/client/src/views/fields/link.js
@@ -1333,28 +1333,19 @@ class LinkFieldView extends BaseFieldView {
return undefined;
}
- actionCreateLink() {
- const viewName = this.getMetadata().get(['clientDefs', this.foreignScope, 'modalViews', 'edit']) ||
- 'views/modals/edit';
-
- Espo.Ui.notifyWait();
-
- this.getCreateAttributesProvider()().then(attributes => {
- this.createView('dialog', viewName, {
- scope: this.foreignScope,
- fullFormDisabled: true,
- attributes: attributes,
- }, view => {
- view.render()
- .then(() => Espo.Ui.notify(false));
+ /**
+ * @protected
+ */
+ async actionCreateLink() {
+ const helper = new RecordModal();
- this.listenToOnce(view, 'after:save', model => {
- view.close();
- this.clearView('dialog');
+ const attributes = await this.getCreateAttributesProvider()();
- this.select(model);
- });
- });
+ await helper.showCreate(this, {
+ entityType: this.foreignScope,
+ fullFormDisabled: true,
+ attributes: attributes,
+ afterSave: model => this.select(model),
});
}