summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/relational_fields.js
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-11-13 13:03:59 +0000
committerLucas Perais (lpe) <lpe@odoo.com>2020-02-06 10:19:00 +0000
commitc98579d25af01c14df4baf57fb4652f3e7469096 (patch)
tree264208ca6a459c1fa4fa43b74c926dc8d65ade5f /addons/web/static/src/js/fields/relational_fields.js
parentb2feb8b7f44ca326e327e203206fa75f6245f61c (diff)
[IMP] web: many2many list editable as m2m_tags
Before this commit, there was a discrepancy between many2many_tags widget and regular many2many list That is, in tag mode, when someone had read access alone on the comodel he could modify the members of the m2m relation on the current model Which couldn't be done in m2m list After this commit, it is possible in a m2m list to add records to a relation, even if we don't have CRUD access on the comodel Task 44074 closes odoo/odoo#40194 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/fields/relational_fields.js')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index 0bf264aca1d..631bf8e8d11 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -1213,14 +1213,20 @@ var FieldX2Many = AbstractField.extend({
* @returns {boolean} true iff the list should contain a 'create' line.
*/
_hasCreateLine: function () {
- return !this.isReadonly && this.activeActions.create && (this.isMany2Many || this.canCreate);
+ return !this.isReadonly && (
+ (this.activeActions.create && this.canCreate) ||
+ (this.isMany2Many)
+ );
},
/**
* @private
* @returns {boolean} true iff the list should add a trash icon on each row.
*/
_hasTrashIcon: function () {
- return !this.isReadonly && this.activeActions.delete && (this.isMany2Many || this.canDelete);
+ return !this.isReadonly && (
+ (this.activeActions.delete && this.canDelete) ||
+ (this.isMany2Many)
+ );
},
/**
* Instanciates or updates the adequate renderer.