Skip to content

EspoCRM – Open Source CRM Application

kanban: revert record after move error

Yuri Kuznetsova571e283d3b6
diff --git a/client/src/views/modals/kanban-move-over.js b/client/src/views/modals/kanban-move-over.js
index 833dfee72b..296252e241 100644
--- a/client/src/views/modals/kanban-move-over.js
+++ b/client/src/views/modals/kanban-move-over.js
@@ -93,21 +93,25 @@ class KanbanMoveOverModalView extends ModalView {
});
}
+ /**
+ * @private
+ * @param {string} status
+ */
moveTo(status) {
- const attributes = {};
-
- attributes[this.statusField] = status;
+ const previousStatus = this.model.attributes[this.statusField];
this.model
- .save(
- attributes,
- {
- patch: true,
- isMoveTo: true,
- }
- )
+ .save({[this.statusField]: status}, {
+ patch: true,
+ isMoveTo: true,
+ })
.then(() => {
Espo.Ui.success(this.translate('Done'));
+ })
+ .catch(() => {
+ this.model.setMultiple({[this.statusField]: previousStatus}, {
+ isMoveTo: true,
+ });
});
this.close();