diff options
| author | Carlos Mayo <carlos.mayo@fairhall.es> | 2019-11-13 09:56:04 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-01-07 14:37:06 +0000 |
| commit | 9f49709ef3ea8a522baf1e0e1e0ca7061921636a (patch) | |
| tree | c4f5e6ede25fcc04253f5a80baa5e909d4bbb75d /addons/web/static/src/js | |
| parent | c86bff6a02617ca1f06a3dadf21924e7e38f5877 (diff) | |
[FIX] web: many2many_checkboxes: react to domain changes
Let's assume a many2many_checkboxes widget in a form view with a
dynamic domain (depending on another field in the view). At first
rendering, the widget contains a checkbox for each value matching
the domain.
Before this rev., if the user changed the value of the field used
in the domain, the many2many_checkboxes wasn't redrawn, so it still
displayed the values matching the previous version of the domain.
Closes #38509
Closes #40173
closes odoo/odoo#42867
X-original-commit: 1ace56f9a8cb56fb39235468dd13447bcbbee40a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 14 |
1 files changed, 12 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 0a3bb640f50..c1f116784fa 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -2571,17 +2571,27 @@ var FieldMany2ManyCheckBoxes = AbstractField.extend({ /** * @private */ - _render: function () { + _renderCheckboxes: function () { var self = this; - this._super.apply(this, arguments); + this.m2mValues = this.record.specialData[this.name]; + this.$el.html(qweb.render(this.template, {widget: this})); _.each(this.value.res_ids, function (id) { self.$('input[data-record-id="' + id + '"]').prop('checked', true); }); }, /** + * @override + * @private + */ + _renderEdit: function () { + this._renderCheckboxes(); + }, + /** + * @override * @private */ _renderReadonly: function () { + this._renderCheckboxes(); this.$("input").prop("disabled", true); }, |
