Merge lp:~unifield-team/unifield-web/uf590_jfb_search_values into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4585
Proposed branch: lp:~unifield-team/unifield-web/uf590_jfb_search_values
Merge into: lp:unifield-web
Diff against target: 40 lines (+13/-3)
1 file modified
addons/openerp/widgets/search.py (+13/-3)
To merge this branch: bzr merge lp:~unifield-team/unifield-web/uf590_jfb_search_values
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+86229@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/widgets/search.py'
2--- addons/openerp/widgets/search.py 2011-05-12 13:55:59 +0000
3+++ addons/openerp/widgets/search.py 2011-12-19 13:19:28 +0000
4@@ -385,7 +385,7 @@
5
6 if kind == 'boolean':
7 # '0' in string because 0 is considering as No Value, and we need 0 as some value.
8- field.options = [[1,_('Yes')],['0',_('No')]]
9+ field.options = [['', ''], [1,_('Yes')],['0',_('No')]]
10 field.validator.if_empty = ''
11
12 default_search = None
13@@ -424,7 +424,7 @@
14 domain = [(name, '>=', defval)]
15
16 elif field.kind == 'boolean':
17- domain = [(name, '=', defval)]
18+ domain = [(name, '=', defval!='0')]
19
20 else:
21 domain = [(name,fields[name].get('comparator','ilike'), defval)]
22@@ -488,7 +488,17 @@
23
24 class Integer(form.Integer): pass
25 class NewLine(form.NewLine): pass
26-class Selection(form.Selection): pass
27+class Selection(form.Selection):
28+ def __init__(self, **attrs):
29+ super(Selection, self).__init__(**attrs)
30+ found_empty = False
31+
32+ for opt in self.options:
33+ if not opt[0]:
34+ found_empty = True
35+
36+ if not found_empty:
37+ self.options.insert(0, ('',''))
38 class Separator(form.Separator): pass
39
40 RANGE_WIDGETS = {

Subscribers

People subscribed via source and target branches

to all changes: