[FIX] web: create="0" in many2many list views
The revision
dd657c42f7
intended to give the possibility to add an existing
record to a many2many list even without the `create` access
on the model of this record.
This is accepted by the ORM, as there is no need of the create
right on the model, only the write on the source model on which
the many2many field is.
The revision has as unexpected side effect to remove the possibility
to manually set `create="0"` on the tree of a many2many field,
to hide the "add an item" of the list view.
As this last feature is more important, we therefore revert this.
We will provide another solution for the above issue.
We think about forcing what the view definition says, so if you
set create="1" on the view, it will display the "add an item" link
in any case, even if you do not have the access right to do it.
This would allow to display the link for the above case, and in case
you actually do not have the access right, and this is an error
in the view definition, you will have an access error raised anyway.
opw-708310
This commit is contained in:
@@ -997,9 +997,7 @@ var X2ManyListView = ListView.extend({
|
||||
*/
|
||||
var X2ManyList = ListView.List.extend({
|
||||
pad_table_to: function (count) {
|
||||
var ftype = this.view.x2m.field.type;
|
||||
var is_readonly = this.view.x2m.get('effective_readonly');
|
||||
if (is_readonly || (ftype === 'one2many' && !this.view.is_action_enabled('create'))) {
|
||||
if (!this.view.is_action_enabled('create') || this.view.x2m.get('effective_readonly')) {
|
||||
this._super(count);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user