From e719824271a6368ce8b3e5ff2a3f5d5a3399b23c Mon Sep 17 00:00:00 2001 From: Pratima Gupta Date: Tue, 20 Nov 2018 06:40:45 +0000 Subject: [IMP] web: hide "Remove" button in FormViewDialog When we open any x2m record (in a FormViewDialog), there is a "Remove" button to delete/unlink the opened record from parent. This button is placed besides "Discard" button and it creates little confusion in some cases. For example, in list view, there's already a bin / 'x' icon depending on the field type using which people are used to delete/unlink the record. And when they open a record, they might accidentally click "Remove" button instead of "Discard". To avoid this, now we won't show "Remove" button when we open record from x2many list view. However, we have to keep this button in case x2many of kanban as there's no other way to remove the record. task-1886913 closes odoo/odoo#34333 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/js/fields/relational_fields.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/fields/relational_fields.js') diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 325bb176e61..d50e03540f2 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1609,7 +1609,7 @@ var FieldOne2Many = FieldX2Many.extend({ fields_view: this.attrs.views && this.attrs.views.form, parentID: this.value.id, viewInfo: this.view, - deletable: this.activeActions.delete, + deletable: this.activeActions.delete && params.deletable, })); }, @@ -1714,7 +1714,7 @@ var FieldOne2Many = FieldX2Many.extend({ on_remove: function () { self._setValue({operation: 'DELETE', ids: [id]}); }, - deletable: this.activeActions.delete, + deletable: this.activeActions.delete && this.view.arch.tag !== 'tree', readonly: this.mode === 'readonly', }); }, @@ -1788,7 +1788,7 @@ var FieldMany2Many = FieldX2Many.extend({ self._setValue({operation: 'FORGET', ids: [ev.data.id]}); }, readonly: this.mode === 'readonly', - deletable: this.activeActions.delete, + deletable: this.activeActions.delete && this.view.arch.tag !== 'tree', string: this.string, }); }, -- cgit v1.2.3