[FIX] web: FieldMany2Many List: allow to add items if create="0"

One can add an item in a Many2Many without creating it, so the action
should be available. However, if the create action is not allowed, there
is no 'Create' button in the SelectCreateDialog.
This commit is contained in:
Aaron Bohy
2017-02-06 09:21:26 +01:00
parent d83d0999e0
commit dd657c42f7
@@ -997,7 +997,9 @@ var X2ManyListView = ListView.extend({
*/
var X2ManyList = ListView.List.extend({
pad_table_to: function (count) {
if (!this.view.is_action_enabled('create') || this.view.x2m.get('effective_readonly')) {
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'))) {
this._super(count);
return;
}
@@ -1304,7 +1306,7 @@ var Many2ManyListView = X2ManyListView.extend({
context: this.x2m.build_context(),
title: _t("Add: ") + this.x2m.string,
alternative_form_view: this.x2m.field.views ? this.x2m.field.views.form : undefined,
no_create: this.x2m.options.no_create,
no_create: this.x2m.options.no_create || !this.is_action_enabled('create'),
on_selected: function(element_ids) {
return self.x2m.data_link_multi(element_ids).then(function() {
self.x2m.reload_current_view();