diff options
| author | Denis Ledoux <dle@odoo.com> | 2015-11-17 13:19:14 +0100 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-11-17 13:19:14 +0100 |
| commit | d47ee18fefed98d6ec07a6fa86443317eab5f4b8 (patch) | |
| tree | 92d2e24cd6452fcaf8931ab9edf5a0df68444adb /addons/web/static/src/js | |
| parent | 238b2027b0628db19fca68acaa6762088e772378 (diff) | |
| parent | c9fce1a40441a559c8a36d4ca1d6b2deaf9cae1f (diff) | |
[MERGE] forward port of branch 8.0 up to c9fce1a
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 5 | ||||
| -rw-r--r-- | addons/web/static/src/js/formats.js | 11 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index c00cedc620b..b15780d252a 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -1047,8 +1047,11 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ return this._super(id, signal); }, alter_ids: function(n_ids) { + var dirty = !_.isEqual(this.ids, n_ids); this._super(n_ids); - this.trigger("dataset_changed", n_ids); + if(dirty) { + this.trigger("dataset_changed", n_ids); + } }, }); instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/; diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index b716f0f0ef3..3461134d725 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -312,7 +312,16 @@ instance.web.round_precision = function(value, precision){ var epsilon_magnitude = Math.log(Math.abs(normalized_value))/Math.log(2); var epsilon = Math.pow(2, epsilon_magnitude - 53); normalized_value += normalized_value >= 0 ? epsilon : -epsilon; - var rounded_value = Math.round(normalized_value); + + /** + * Javascript performs strictly the round half up method, which is asymmetric. However, in + * Python, the method is symmetric. For example: + * - In JS, Math.round(-0.5) is equal to -0. + * - In Python, round(-0.5) is equal to -1. + * We want to keep the Python behavior for consistency. + */ + var sign = normalized_value < 0 ? -1.0 : 1.0; + var rounded_value = sign * Math.round(Math.abs(normalized_value)); return rounded_value * precision; }; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 929db311e30..04f6511a1de 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4413,10 +4413,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ })); this.on('edit:after', this, this.proxy('_after_edit')); this.on('save:before cancel:before', this, this.proxy('_before_unedit')); - - this.records - .bind('add', this.proxy("changed_records")) - .bind('remove', this.proxy("changed_records")); this.on('save:after', this, this.proxy("changed_records")); }, start: function () { |
