diff options
| author | Alexandre Kühn <alexkuhn@users.noreply.github.com> | 2018-01-03 11:42:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-03 11:42:39 +0100 |
| commit | 8bc7cebd9c19ae8f77378d115a8401d7b7de56b0 (patch) | |
| tree | 4cc13e4a51b11e1da1f30996cab01d3d6876a451 /addons/web/static/src/js/fields/relational_fields.js | |
| parent | c8fa2d581caa13e881188552e6e2e22f8e858f7f (diff) | |
[IMP] web: many2many editable list with X remove icon (#20978)
In many2many lists, the remove record from the widget is a trash bin.
It is confusing, as people feel they are deleting it when they are
only unlinking it.
So in many2many, we propose to change the trash icon by a 'X'.
This icon appears in many2many relations and in many2many widgets:
even though hr.expense.sheet defines the expense lines as a one2many,
it uses a many2many widget, so we use a 'X' instead of the trash bin.
To avoid ambiguity, we decided to rename 'delete' to 'remove'.
Diffstat (limited to 'addons/web/static/src/js/fields/relational_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 4ad3dc1a828..52654c4ce3a 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -635,11 +635,11 @@ var FieldX2Many = AbstractField.extend({ discard_changes: '_onDiscardChanges', edit_line: '_onEditLine', field_changed: '_onFieldChanged', - kanban_record_delete: '_onDeleteRecord', - list_record_delete: '_onDeleteRecord', open_record: '_onOpenRecord', - save_line: '_onSaveLine', + kanban_record_delete: '_onRemoveRecord', + list_record_remove: '_onRemoveRecord', resequence: '_onResequence', + save_line: '_onSaveLine', toggle_column_order: '_onToggleColumnOrder', }), @@ -661,6 +661,7 @@ var FieldX2Many = AbstractField.extend({ this.operations = []; this.isReadonly = this.mode === 'readonly'; this.view = this.attrs.views[this.attrs.mode]; + this.isMany2Many = this.field.type === 'many2many' || this.attrs.widget === 'many2many'; this.activeActions = {}; this.recordParams = {fieldName: this.name, viewType: this.viewType}; var arch = this.view && this.view.arch; @@ -798,6 +799,7 @@ var FieldX2Many = AbstractField.extend({ mode: this.mode, addCreateLine: !this.isReadonly && this.activeActions.create, addTrashIcon: !this.isReadonly && this.activeActions.delete, + isMany2Many: this.isMany2Many, viewType: viewType, columnInvisibleFields: this.currentColInvisibleFields, }); @@ -947,10 +949,9 @@ var FieldX2Many = AbstractField.extend({ * @private * @param {OdooEvent} ev */ - _onDeleteRecord: function (ev) { + _onRemoveRecord: function (ev) { ev.stopPropagation(); - var shouldForget = this.attrs.widget === 'many2many' || this.field.type === 'many2many'; - var operation = shouldForget ? 'FORGET' : 'DELETE'; + var operation = this.isMany2Many ? 'FORGET' : 'DELETE'; this._setValue({ operation: operation, ids: [ev.data.id], |
