LEFT | RIGHT |
1 #This file is part of Tryton. The COPYRIGHT file at the top level of | 1 #This file is part of Tryton. The COPYRIGHT file at the top level of |
2 #this repository contains the full copyright notices and license terms. | 2 #this repository contains the full copyright notices and license terms. |
3 import gtk | 3 import gtk |
4 from tryton.gui.window.view_form.screen import Screen | 4 from tryton.gui.window.view_form.screen import Screen |
5 from interface import WidgetInterface | 5 from interface import WidgetInterface |
6 from one2many import Dialog | 6 from one2many import Dialog |
7 import tryton.rpc as rpc | 7 import tryton.rpc as rpc |
8 from tryton.gui.window.win_search import WinSearch | 8 from tryton.gui.window.win_search import WinSearch |
9 from tryton.gui.window.view_form.widget_search.form import _LIMIT | 9 from tryton.gui.window.view_form.widget_search.form import _LIMIT |
10 import tryton.common as common | 10 import tryton.common as common |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 self.screen.display() | 159 self.screen.display() |
160 return False | 160 return False |
161 super(Many2Many, self).display(model, model_field) | 161 super(Many2Many, self).display(model, model_field) |
162 new_models = model_field.get_client(model) | 162 new_models = model_field.get_client(model) |
163 if self.screen.models != new_models: | 163 if self.screen.models != new_models: |
164 self.screen.models_set(new_models) | 164 self.screen.models_set(new_models) |
165 self.screen.display() | 165 self.screen.display() |
166 return True | 166 return True |
167 | 167 |
168 def display_value(self): | 168 def display_value(self): |
169 return self._view.modelfield.rec_name(self._view.model) | 169 ids = self._view.modelfield.get_default(self._view.model) |
| 170 try: |
| 171 result = rpc.execute('model', self.attrs['relation'], 'read', |
| 172 ids, ['rec_name'], rpc.CONTEXT) |
| 173 except: |
| 174 return str(ids) |
| 175 return ', '.join(x['rec_name'] for x in result) |
170 | 176 |
171 def set_value(self, model, model_field): | 177 def set_value(self, model, model_field): |
172 self.screen.current_view.set_value() | 178 self.screen.current_view.set_value() |
173 return True | 179 return True |
LEFT | RIGHT |