示例#1
0
 def activate(menuitem, action, atype):
     rec = load(record)
     action = Action.evaluate(action, atype, rec)
     data = {"model": model, "id": rec.id, "ids": [rec.id]}
     event = gtk.get_current_event()
     allow_similar = False
     if event.state & gtk.gdk.CONTROL_MASK or event.state & gtk.gdk.MOD1_MASK:
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         Action._exec_action(action, data, {})
示例#2
0
 def _action(self, action, atype):
     action = action.copy()
     if not self.screen.save_current():
         return
     record_id = self.screen.id_get()
     record_ids = self.screen.sel_ids_get()
     action = Action.evaluate(action, atype, self.screen.current_record)
     data = {
         'model': self.screen.model_name,
         'id': record_id,
         'ids': record_ids,
     }
     Action._exec_action(action, data, self.context)
示例#3
0
 def _action(self, action, atype):
     action = action.copy()
     if not self.screen.save_current():
         return
     record_id = self.screen.id_get()
     record_ids = self.screen.sel_ids_get()
     action = Action.evaluate(action, atype, self.screen.current_record)
     data = {
         'model': self.screen.model_name,
         'id': record_id,
         'ids': record_ids,
     }
     Action._exec_action(action, data, self.context)
示例#4
0
 def _action(self, action, atype):
     action = action.copy()
     if not self.screen.save_current():
         return
     record_id = (self.screen.current_record.id
                  if self.screen.current_record else None)
     record_ids = [r.id for r in self.screen.selected_records]
     action = Action.evaluate(action, atype, self.screen.current_record)
     data = {
         'model': self.screen.model_name,
         'id': record_id,
         'ids': record_ids,
     }
     Action._exec_action(action, data, self.screen.context)
示例#5
0
文件: form.py 项目: coopengo/tryton
 def _action(self, action, atype):
     action = action.copy()
     if not self.screen.save_current():
         return
     record_id = (self.screen.current_record.id
         if self.screen.current_record else None)
     record_ids = [r.id for r in self.screen.selected_records]
     action = Action.evaluate(action, atype, self.screen.current_record)
     data = {
         'model': self.screen.model_name,
         'id': record_id,
         'ids': record_ids,
     }
     Action._exec_action(action, data, self.screen.context)
示例#6
0
 def execute_actions():
     for action in result.get('actions', []):
         for k, v in [
             ('direct_print', self.direct_print),
             ('email_print', self.email_print),
             ('email', self.email),
         ]:
             action[0].setdefault(k, v)
         context = self.context.copy()
         # Remove wizard keys added by run
         del context['active_id']
         del context['active_ids']
         del context['active_model']
         del context['action_id']
         Action._exec_action(*action, context=context)
示例#7
0
 def activate(menuitem, action, atype):
     rec = load(record)
     action = Action.evaluate(action, atype, rec)
     data = {
         'model': model,
         'id': rec.id,
         'ids': [rec.id],
     }
     event = gtk.get_current_event()
     allow_similar = False
     if (event.state & gtk.gdk.CONTROL_MASK
             or event.state & gtk.gdk.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         Action._exec_action(action, data, rec.get_context())
 def click_and_relate(self, action, value, path):
     data = {}
     context = {}
     act = action.copy()
     if not(value):
         message(_('You must select a record to use the relation!'))
         return False
     from tryton.gui.window.view_form.screen import Screen
     screen = Screen(self.screen.group.fields[
         path[1].name].attrs['relation'])
     screen.load([value])
     encoder = PYSONEncoder()
     act['domain'] = encoder.encode(screen.current_record.expr_eval(
         act.get('domain', []), check_load=False))
     act['context'] = encoder.encode(screen.current_record.expr_eval(
         act.get('context', {}), check_load=False))
     data['model'] = self.screen.model_name
     data['id'] = value
     data['ids'] = [value]
     return Action._exec_action(act, data, context)