~ubuntu-branches/ubuntu/trusty/openerp-client/trusty

« back to all changes in this revision

Viewing changes to bin/widget/view/form_gtk/many2one.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-10-03 08:41:01 UTC
  • mfrom: (11.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091003084101-57m9mup53tje0o0q
Tags: 5.0.6-2
* Manually removing build directory in clean target (Closes: #549215).
* Making quilt build-depends versioned (Closes: #549212).

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
        self.but_find = Button('gtk-find', self.sig_find, _('Search a resource'))
160
160
        self.widget.pack_start(self.but_find, padding=2, expand=False, fill=False)
161
161
 
 
162
        self.value_on_field = ''
162
163
        self.ok = True
163
164
        self._readonly = False
164
165
        self.model_type = attrs['relation']
239
240
            context = self._view.modelfield.context_get(self._view.model)
240
241
            self.wid_text.grab_focus()
241
242
 
242
 
            ids = rpc.session.rpc_exec_auth('/object', 'execute', self.attrs['relation'], 'name_search', self.wid_text.get_text() or '', domain, 'ilike', context)
 
243
            name_search = self.wid_text.get_text() or ''
 
244
            if name_search == self.value_on_field:
 
245
                name_search = ''
 
246
                
 
247
            ids = rpc.session.rpc_exec_auth('/object', 'execute', self.attrs['relation'], 'name_search', name_search, domain, 'ilike', context)
243
248
            if (len(ids)==1) and leave:
244
249
                self._view.modelfield.set_client(self._view.model, ids[0],
245
250
                        force_change=True)
327
332
        super(many2one, self).display(model, model_field)
328
333
        self.ok=False
329
334
        res = model_field.get_client(model)
330
 
        self.wid_text.set_text((res and str(res)) or '')
 
335
        value_set = (res and str(res)) or ''
 
336
        self.wid_text.set_text(value_set)
 
337
        self.value_on_field = value_set
331
338
        self.but_open.set_sensitive(bool(res))
332
339
        self.ok=True
333
340