Merge lp:~openerp-dev/openerp-web/7.0-opw-587802-rha into lp:openerp-web/7.0

Proposed by Rifakat Husen (OpenERP)
Status: Rejected
Rejected by: Xavier (Open ERP)
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-587802-rha
Merge into: lp:openerp-web/7.0
Diff against target: 12 lines (+1/-1)
1 file modified
addons/web/static/src/js/view_form.js (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-587802-rha
Reviewer Review Type Date Requested Status
Xavier (Open ERP) Pending
Review via email: mp+153305@code.launchpad.net

Description of the change

When widget=statusbar is used on any field, domain over statusbar was not properly handled.
It adds '|' even if the domain contains only one element. '|' should only be added when there is second/another element.

Reproduce:
In module fleet,
1. Fleet > Vehicles > Vehicles, click on the menu
2. click on the vehicle name from kanban and it will throw an error

File "/home/rha/workspace/openerp/7.0/server/openerp/osv/expression.py", line 202, in normalize_domain
    assert expected == 0, 'This domain is syntactically not correct: %s' % (domain)
AssertionError: This domain is syntactically not correct: ['|', ['id', '=', False]]

Fix: put a check whether there is another content to add and then apply '|'

Thanks for the review,
Rifakat Haradwala

To post a comment you must log in.
Revision history for this message
Csaba TOTH (tsabi) wrote :

This was fixed in another was in rev 3840

Unmerged revisions

3840. By Rifakat Husen (OpenERP)

[FIX] fix issue for the statusbar domain,
it puts '|' whithout checking the second domain existance, needs to check whether there is another
domain or not and if yes then apply OR

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-03-13 10:17:56 +0000
3+++ addons/web/static/src/js/view_form.js 2013-03-14 09:28:19 +0000
4@@ -5335,7 +5335,7 @@
5 },
6 calc_domain: function() {
7 var d = instance.web.pyeval.eval('domain', this.build_domain());
8- domain = ['|', ['id', '=', this.get('value')]].concat(d);
9+ domain = !_.isEmpty(d)? ['|', ['id', '=', this.get('value')]].concat(d) : [['id', '=', this.get('value')]];
10 if (! _.isEqual(domain, this.get("evaluated_selection_domain"))) {
11 this.set("evaluated_selection_domain", domain);
12 }