diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-02-06 08:59:01 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-02-06 09:21:26 +0100 |
| commit | dd657c42f7cbac01294ef794bf0e697ed495c722 (patch) | |
| tree | d5518f9b1519ac57aff4f71e1a1ca574b803cb52 /addons/web/static/src/js/views/form_relational_widgets.js | |
| parent | d83d0999e052b3f58ff77a6798e099d38337cec7 (diff) | |
[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.
Diffstat (limited to 'addons/web/static/src/js/views/form_relational_widgets.js')
| -rw-r--r-- | addons/web/static/src/js/views/form_relational_widgets.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 46136e21565..4299bda9895 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -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(); |
