本文整理匯總了Python中tryton.gui.window.view_form.screen.Screen.unremove方法的典型用法代碼示例。如果您正苦於以下問題:Python Screen.unremove方法的具體用法?Python Screen.unremove怎麽用?Python Screen.unremove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tryton.gui.window.view_form.screen.Screen
的用法示例。
在下文中一共展示了Screen.unremove方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: One2Many
# 需要導入模塊: from tryton.gui.window.view_form.screen import Screen [as 別名]
# 或者: from tryton.gui.window.view_form.screen.Screen import unremove [as 別名]
#.........這裏部分代碼省略.........
self.view.set_value()
record = self.screen.current_record
if record:
fields = self.screen.current_view.get_fields()
if not record.validate(fields):
self.screen.display()
return
WinForm(self.screen, lambda a: None)
def _sig_next(self, widget):
self.view.set_value()
record = self.screen.current_record
if record:
fields = self.screen.current_view.get_fields()
if not record.validate(fields):
self.screen.display()
return
self.screen.display_next()
def _sig_previous(self, widget):
self.view.set_value()
record = self.screen.current_record
if record:
fields = self.screen.current_view.get_fields()
if not record.validate(fields):
self.screen.display()
return
self.screen.display_prev()
def _sig_remove(self, widget, remove=False):
self.screen.remove(remove=remove)
def _sig_undelete(self, button):
self.screen.unremove()
def _sig_activate(self, *args):
self._sig_add()
self.wid_text.grab_focus()
def _focus_out(self, *args):
if self.wid_text.get_text():
self._sig_add()
def _sig_add(self, *args):
self.view.set_value()
domain = self.field.domain_get(self.record)
context = self.field.context_get(self.record)
domain = domain[:]
domain.extend(self.record.expr_eval(self.attrs.get('add_remove')))
removed_ids = self.field.get_removed_ids(self.record)
try:
if self.wid_text.get_text():
dom = [('rec_name', 'ilike',
'%' + self.wid_text.get_text() + '%'),
['OR', domain, ('id', 'in', removed_ids)]]
else:
dom = ['OR', domain, ('id', 'in', removed_ids)]
ids = RPCExecute('model', self.attrs['relation'], 'search', dom,
0, CONFIG['client.limit'], None, context=context)
except RPCException:
return False
def callback(result):
if result:
ids = [x[0] for x in result]
示例2: One2Many
# 需要導入模塊: from tryton.gui.window.view_form.screen import Screen [as 別名]
# 或者: from tryton.gui.window.view_form.screen.Screen import unremove [as 別名]
#.........這裏部分代碼省略.........
search_set()
def _sig_edit(self, widget=None):
if not self.but_open.props.sensitive:
return
if not self._validate():
return
record = self.screen.current_record
if record:
WinForm(self.screen, lambda a: None)
def _sig_next(self, widget):
if not self._validate():
return
self.screen.display_next()
def _sig_previous(self, widget):
if not self._validate():
return
self.screen.display_prev()
def _sig_remove(self, widget, remove=False):
access = common.MODELACCESS[self.screen.model_name]
if remove:
if not access["write"] or not access["read"]:
return
else:
if not access["delete"]:
return
self.screen.remove(remove=remove)
def _sig_undelete(self, button):
self.screen.unremove()
def _sig_add(self, *args):
if not self.focus_out:
return
access = common.MODELACCESS[self.screen.model_name]
if not access["write"] or not access["read"]:
return
domain = self.field.domain_get(self.record)
context = self.field.context_get(self.record)
domain = [domain, self.record.expr_eval(self.attrs.get("add_remove"))]
removed_ids = self.field.get_removed_ids(self.record)
domain = ["OR", domain, ("id", "in", removed_ids)]
text = self.wid_text.get_text().decode("utf-8")
self.focus_out = False
sequence = None
if self.screen.current_view.view_type == "tree":
sequence = self.screen.current_view.attributes.get("sequence")
def callback(result):
self.focus_out = True
if result:
ids = [x[0] for x in result]
self.screen.load(ids, modified=True)
self.screen.display(res_id=ids[0])
if sequence:
self.screen.group.set_sequence(field=sequence)
self.screen.set_cursor()
self.wid_text.set_text("")
win = WinSearch(
示例3: One2Many
# 需要導入模塊: from tryton.gui.window.view_form.screen import Screen [as 別名]
# 或者: from tryton.gui.window.view_form.screen.Screen import unremove [as 別名]
#.........這裏部分代碼省略.........
search_set()
def _sig_edit(self, widget=None):
if not common.MODELACCESS[self.screen.model_name]['read']:
return
if not self._validate():
return
record = self.screen.current_record
if record:
WinForm(self.screen, lambda a: None)
def _sig_next(self, widget):
if not self._validate():
return
self.screen.display_next()
def _sig_previous(self, widget):
if not self._validate():
return
self.screen.display_prev()
def _sig_remove(self, widget, remove=False):
access = common.MODELACCESS[self.screen.model_name]
if remove:
if not access['write'] or not access['read']:
return
else:
if not access['delete']:
return
self.screen.remove(remove=remove)
def _sig_undelete(self, button):
self.screen.unremove()
def _sig_add(self, *args):
if not self.focus_out:
return
access = common.MODELACCESS[self.screen.model_name]
if not access['write'] or not access['read']:
return
self.view.set_value()
domain = self.field.domain_get(self.record)
context = self.field.context_get(self.record)
domain = [domain, self.record.expr_eval(self.attrs.get('add_remove'))]
removed_ids = self.field.get_removed_ids(self.record)
domain = ['OR', domain, ('id', 'in', removed_ids)]
text = self.wid_text.get_text().decode('utf-8')
self.focus_out = False
sequence = None
if self.screen.current_view.view_type == 'tree':
sequence = self.screen.current_view.attributes.get('sequence')
def callback(result):
self.focus_out = True
if result:
ids = [x[0] for x in result]
self.screen.load(ids, modified=True)
self.screen.display(res_id=ids[0])
if sequence:
self.screen.group.set_sequence(field=sequence)
self.screen.set_cursor()
self.wid_text.set_text('')