~openerp-dev/openobject-client/dev_client_rga

« back to all changes in this revision

Viewing changes to bin/widget_search/selection.py

  • Committer: RGA(OpenERP)
  • Date: 2011-01-19 05:52:51 UTC
  • mfrom: (1369.10.89 client)
  • Revision ID: rga@tinyerp.com-20110119055251-vh2pmznpxcs445e1
Merge with trunk client

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        self.attrs = attrs
35
35
        self._selection = {}
36
36
        self.name = name
 
37
        self.val_id = False
37
38
        if 'selection' in attrs:
38
39
            self.set_popdown(attrs.get('selection',[]))
39
 
 
40
40
        if self.default_search:
41
41
            if self.attrs['type'] == 'many2one':
42
42
                self._value_set(int(self.default_search))
83
83
            self.widget.set_active(self.indexes[widget.get_text()])
84
84
 
85
85
    def _value_get(self):
86
 
        model = self.widget.get_model()
87
 
        index = self.widget.get_active()
88
86
        res = self.widget.child.get_text()
89
87
        context = {}
90
88
        operator = 'ilike'
91
 
        if index>=0:
92
 
            res = self._selection.get(model[index][0], False)
 
89
        if self._selection.get(res, False):
 
90
            res = self._selection.get(res, False)
93
91
            operator = self.attrs.get('operator','=')
94
92
            context = tools.expr_eval(self.attrs.get('context',"{}"), {'self':res})
95
93
        if res: