Merge lp:~openerp-dev/openerp-web/trunk-bug-1241359-msh into lp:openerp-web

Proposed by Mohammed Shekha(Open ERP)
Status: Rejected
Rejected by: Martin Trigaux (OpenERP)
Proposed branch: lp:~openerp-dev/openerp-web/trunk-bug-1241359-msh
Merge into: lp:openerp-web
Diff against target: 29 lines (+11/-8)
1 file modified
addons/web/static/src/js/view_form.js (+11/-8)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-bug-1241359-msh
Reviewer Review Type Date Requested Status
Christophe Matthieu (OpenERP) Pending
Review via email: mp+199769@code.launchpad.net

Description of the change

Hello,

Fixed the issue of statusbar, statusbar widget doesn't update with new selection when field is type of selection, issue is due to latest changes in statubar widget which triggers get_selection only when domain changed, in the case of selection widget there is no need to trigger get_selection based on domain change.

Demo: Sale -> Create Sale Order -> Confirm It -> and then Cancel it, Cancel state not updated in statusbar.

Reason: get_selection not called, due to latest changes in statusbar get_selection is called only when there is a change in domain, this implementation is true if type of field is many2one, for selection type field this fails.

Thanks

To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hello,

This was already fixed in the saas-2 branch[1] (and forward ported to trunk). I will reject this one then.

Regards

[1] http://bazaar.launchpad.net/~openerp/openerp-web/saas-2/revision/3898

Unmerged revisions

3907. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Web: statusbar widget doesn't update with new selection when field is type of selection, issue is due to latest changes in statubar widget which triggers get_selection only when domain changed, in the case of selection widget there is no need to trigger get_selection based on domain change.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/view_form.js'
2--- addons/web/static/src/js/view_form.js 2013-12-19 13:40:55 +0000
3+++ addons/web/static/src/js/view_form.js 2013-12-20 09:21:45 +0000
4@@ -5554,14 +5554,17 @@
5 },
6 calc_domain: function() {
7 var d = instance.web.pyeval.eval('domain', this.build_domain());
8- var domain = []; //if there is no domain defined, fetch all the records
9-
10- if (d.length) {
11- domain = ['|',['id', '=', this.get('value')]].concat(d);
12- }
13-
14- if (! _.isEqual(domain, this.get("evaluated_selection_domain"))) {
15- this.set("evaluated_selection_domain", domain);
16+ if (this.field.type == 'many2one') {
17+ var domain = []; //if there is no domain defined, fetch all the records
18+ if (d.length) {
19+ domain = ['|',['id', '=', this.get('value')]].concat(d);
20+ }
21+
22+ if (! _.isEqual(domain, this.get("evaluated_selection_domain"))) {
23+ this.set("evaluated_selection_domain", domain);
24+ }
25+ } else {
26+ this.set("evaluated_selection_domain", ['|', ['id', '=', this.get('value')]].concat(d));
27 }
28 },
29 /** Get the selection and render it