From 5e1a5b7dbc6e5dbf8446a5f6144f0a8a72426e26 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 13 Oct 2014 18:24:57 +0200 Subject: [PATCH 1/3] [FIX] web: wait for deferreds when actualizing mode In edit mode, in a *2many with many2many_tags, when adding a new tag when none was set, discarding the form let the new tags displayed while it shouldn't (only a display issue, the tag wasn't added in database) Fixes #2926 --- addons/web/static/src/js/view_form.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 439aaf0ed89..6a3fad2810b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -117,6 +117,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.mutating_mutex = new $.Mutex(); this.on_change_list = []; this.save_list = []; + this.render_value_defs = []; this.reload_mutex = new $.Mutex(); this.__clicked_inside = false; this.__blur_timeout = null; @@ -686,6 +687,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } else if (mode === "create") { mode = "edit"; } + this.render_value_defs = []; this.set({actual_mode: mode}); }, check_actual_mode: function(source, options) { @@ -736,12 +738,15 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }); }, on_button_cancel: function(event) { + var self = this; if (this.can_be_discarded()) { if (this.get('actual_mode') === 'create') { this.trigger('history_back'); } else { this.to_view_mode(); - this.trigger('load_record', this.datarecord); + $.when.apply(null, this.render_value_defs).then(function(){ + self.trigger('load_record', self.datarecord); + }); } } this.trigger('on_button_cancel'); @@ -2244,7 +2249,7 @@ instance.web.form.ReinitializeWidgetMixin = { instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.ReinitializeWidgetMixin, { reinitialize: function() { instance.web.form.ReinitializeWidgetMixin.reinitialize.call(this); - this.render_value(); + this.view.render_value_defs.push(this.render_value()); }, }); @@ -4262,7 +4267,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in } }; if (! values || values.length > 0) { - this._display_orderer.add(dataset.name_get(values)).done(handle_names); + return this._display_orderer.add(dataset.name_get(values)).done(handle_names); } else { handle_names([]); } From 0b13f328685d7401e395962f14952e5076cffe9c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 14 Oct 2014 13:41:52 +0200 Subject: [PATCH 2/3] [FIX] email_template: do not try to add user signature if none set append_content_to_html expects two strings. If the user has no signature, it returns user.signature returns False --- addons/email_template/email_template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 335b67fcfb1..c5e24b0da5f 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -319,7 +319,8 @@ class email_template(osv.osv): or False if template.user_signature: signature = self.pool.get('res.users').browse(cr, uid, uid, context).signature - values['body_html'] = tools.append_content_to_html(values['body_html'], signature) + if signature: + values['body_html'] = tools.append_content_to_html(values['body_html'], signature) if values['body_html']: values['body'] = tools.html_sanitize(values['body_html']) From 75d3ea6208a8495610e1ba9ade93eee057222dc7 Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Mon, 13 Oct 2014 16:42:53 +0200 Subject: [PATCH 3/3] [FIX] point_of_sale: fixed display of untaxed amount in sales lines report --- addons/point_of_sale/report/pos_lines.rml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/report/pos_lines.rml b/addons/point_of_sale/report/pos_lines.rml index 1ed8e33eede..1b6774578c0 100644 --- a/addons/point_of_sale/report/pos_lines.rml +++ b/addons/point_of_sale/report/pos_lines.rml @@ -202,7 +202,7 @@ Net Total : - [[ formatLang(o.amount_total, currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(o.amount_total - o.amount_tax, currency_obj=o.pricelist_id.currency_id) ]] @@ -228,7 +228,7 @@ Total: - [[ formatLang(o.amount_total + o.amount_tax, currency_obj=o.pricelist_id.currency_id) ]] + [[ formatLang(o.amount_total, currency_obj=o.pricelist_id.currency_id) ]]