Skip to content

EspoCRM – Open Source CRM Application

ref

Yuri Kuznetsovdc527c2cf697
diff --git a/client/src/views/site/navbar/quick-create.js b/client/src/views/site/navbar/quick-create.js
index 20a8ab6c1e..2a10843e32 100644
--- a/client/src/views/site/navbar/quick-create.js
+++ b/client/src/views/site/navbar/quick-create.js
@@ -27,6 +27,7 @@
************************************************************************/
import View from 'view';
+import RecordModal from 'helpers/record-modal';
class QuickCreateNavbarView extends View {
@@ -90,15 +91,34 @@ class QuickCreateNavbarView extends View {
return this.list.length > 0;
}
- processCreate(scope) {
+ /**
+ * @private
+ * @param {string} scope
+ */
+ async processCreate(scope) {
Espo.Ui.notifyWait();
- const type = this.getMetadata().get(['clientDefs', scope, 'quickCreateModalType']) || 'edit';
- const viewName = this.getMetadata().get(['clientDefs', scope, 'modalViews', type]) || 'views/modals/edit';
+ const type = this.getMetadata().get(`clientDefs.${scope}.quickCreateModalType`);
- this.createView('dialog', viewName , {scope: scope})
- .then(view => view.render())
- .then(() => Espo.Ui.notify(false));
+ if (type) {
+ const viewName = this.getMetadata().get(`clientDefs.${scope}.modalViews.${type}`);
+
+ if (viewName) {
+ const view = await this.createView('modal', viewName , {scope: scope});
+
+ await view.render();
+
+ Espo.Ui.notify();
+
+ return;
+ }
+ }
+
+ const helper = new RecordModal();
+
+ await helper.showCreate(this, {
+ entityType: scope,
+ });
}
}
diff --git a/schema/metadata/clientDefs.json b/schema/metadata/clientDefs.json
index 4c1a4f1c16..2d63defef3 100644
--- a/schema/metadata/clientDefs.json
+++ b/schema/metadata/clientDefs.json
@@ -74,6 +74,10 @@
"type": "string"
}
},
+ "quickCreateModalType": {
+ "type": "string",
+ "description": "A modal view type to be used for quick create."
+ },
"listViewModeList": {
"type": "array",
"items": {