OLD | NEW |
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 time | 3 import time |
4 import datetime | 4 import datetime |
5 import tryton.rpc as rpc | 5 import tryton.rpc as rpc |
6 from tryton.wizard import Wizard | 6 from tryton.wizard import Wizard |
7 from tryton.common import message, error, selection, file_open, mailto | 7 from tryton.common import message, error, selection, file_open, mailto |
8 from tryton.gui.window import Window | 8 from tryton.gui.window import Window |
9 from tryton.pyson import PYSONDecoder | 9 from tryton.pyson import PYSONDecoder |
10 import gettext | 10 import gettext |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 res = rpc.execute('model', 'ir.action', 'read', act_id, | 81 res = rpc.execute('model', 'ir.action', 'read', act_id, |
82 ['type'], ctx) | 82 ['type'], ctx) |
83 except Exception, exception: | 83 except Exception, exception: |
84 common.process_exception(exception, window) | 84 common.process_exception(exception, window) |
85 return | 85 return |
86 if not res: | 86 if not res: |
87 raise Exception, 'ActionNotFound' | 87 raise Exception, 'ActionNotFound' |
88 action_type = res['type'] | 88 action_type = res['type'] |
89 try: | 89 try: |
90 res = rpc.execute('model', action_type, 'search_read', | 90 res = rpc.execute('model', action_type, 'search_read', |
91 [('action', '=', act_id)], 0, 1, None, ctx, None) | 91 [('action', '=', act_id)], 0, 1, None, None, ctx) |
92 except Exception, exception: | 92 except Exception, exception: |
93 common.process_exception(exception, window) | 93 common.process_exception(exception, window) |
94 return | 94 return |
95 Action._exec_action(res, window, datas) | 95 Action._exec_action(res, window, datas) |
96 | 96 |
97 @staticmethod | 97 @staticmethod |
98 def _exec_action(action, window, datas=None, context=None): | 98 def _exec_action(action, window, datas=None, context=None): |
99 if context is None: | 99 if context is None: |
100 context = {} | 100 context = {} |
101 if datas is None: | 101 if datas is None: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 res = selection(_('Select your action'), keyact, window, | 199 res = selection(_('Select your action'), keyact, window, |
200 alwaysask=alwaysask) | 200 alwaysask=alwaysask) |
201 if res: | 201 if res: |
202 (name, action) = res | 202 (name, action) = res |
203 Action._exec_action(action, window, data, context=context) | 203 Action._exec_action(action, window, data, context=context) |
204 return (name, action) | 204 return (name, action) |
205 elif not len(keyact) and warning: | 205 elif not len(keyact) and warning: |
206 message(_('No action defined!'), window) | 206 message(_('No action defined!'), window) |
207 return False | 207 return False |
OLD | NEW |