From ac5a1662f2ff1cc2287c1453920c80e78c617c0b Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 21 Nov 2018 16:37:40 +0000 Subject: [FIX] web: propagate can_create into the search popup When creating a SO line and clicking on search more for product_id Before this commit, every user had the button "Create" to create a product.product After this commit, only user in groups that actually can create a product have the button OPW 1910371 closes odoo/odoo#28924 --- addons/web/static/src/js/fields/relational_fields.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src/js/fields') diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index dcbd9dc09fd..5a211b3ae0b 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -468,6 +468,7 @@ var FieldMany2One = AbstractField.extend({ initial_ids: ids ? _.map(ids, function (x) { return x[0]; }) : undefined, initial_view: view, disable_multiple_selection: true, + no_create: !self.can_create, on_selected: function (records) { self.reinitialize(records[0]); self.activate(); -- cgit v1.2.3 From 23313583b2b111610abb1940034859b07282f33b Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 26 Nov 2018 12:54:39 +0000 Subject: [FIX] web: progressbar updates on field reset Have a form record with a progress bar Modify the max_value of the progress, as well as the current_value bar through an onchange Before this commit, the new max_value was not taken into account After this commit, it is. closes odoo/odoo#29056 --- addons/web/static/src/js/fields/basic_fields.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'addons/web/static/src/js/fields') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index b52567d5c7a..fd156f2d00b 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -2014,6 +2014,18 @@ var FieldProgressBar = AbstractField.extend({ this.$('.o_progressbar_value').focus().select(); } }, + /** + * The progress bar has more than one field/value to deal with + * i.e. max_value + * + * @override + * @private + */ + _reset: function () { + this._super.apply(this, arguments); + var new_max_value = this.recordData[this.nodeOptions.max_value]; + this.max_value = new_max_value !== undefined ? new_max_value : this.max_value; + }, isSet: function () { return true; }, -- cgit v1.2.3