Пример #1
0
 def edit(menuitem):
     with Window(hide_current=True, allow_similar=True):
         Window.create(model,
                       view_ids=field.attrs.get('view_ids', '').split(','),
                       res_id=id_(record),
                       mode=['form'],
                       name=field.attrs.get('string'))
Пример #2
0
    def gnuhealth_cmd(self,command):

        cmd = command.split()[0]
        args = command.split()[1:]
        domain_name = domain = None
        search_string = '%'

        res = RPCExecute('model', 'gnuhealth.command', 'search_read',
                [('name', '=', cmd)], limit=1,field_names='model.name')

        if (res):
            res = res[0]
            if (res['domain']):
                domain_name = ast.literal_eval(res['domain'])
            model_name = res['model']
            label = res['label']
            if args:
                arg1 = args.pop()
                search_string = "%" + arg1 + "%"

            Window.create(model_name,
                mode=['tree','form'],
                name=label,
                domain=domain_name,
                limit = CONFIG['client.limit'],
                search_value = [('rec_name', 'ilike', search_string)]
                )

        else:
            common.message(_('Command not found.'))
Пример #3
0
 def open_wizard(wizard):
     if not wizard:
         return
     try:
         data = json.loads(params.get('data', '{}'),
                           object_hook=object_hook)
         direct_print = json.loads(params.get('direct_print', 'false'))
         email_print = json.loads(params.get('email_print', 'false'))
         email = json.loads(params.get('email', 'null'))
         name = json.loads(params.get('name', '""'))
         window = json.loads(params.get('window', 'false'))
         context = json.loads(params.get('context', '{}'),
                              object_hook=object_hook)
     except ValueError:
         return
     try:
         Window.create_wizard(wizard,
                              data,
                              direct_print=direct_print,
                              email_print=email_print,
                              email=email,
                              name=name,
                              context=context,
                              window=window)
     except Exception:
         # Prevent crashing the client
         return
Пример #4
0
def translate_view(datas):
    model = datas['model']
    Window.create(False,
                  'ir.translation',
                  res_id=False,
                  domain=[('model', '=', model)],
                  mode=['tree', 'form'])
Пример #5
0
    def __call__(self, resource, obj_id, context):
        res = super(ConcurrencyDialog, self).__call__(resource, obj_id,
            context)

        if res == gtk.RESPONSE_OK:
            return True
        if res == gtk.RESPONSE_APPLY:
            from tryton.gui.window import Window
            Window.create(False, resource, res_id=obj_id,
                domain=[('id', '=', obj_id)],
                context=context, mode=['form', 'tree'])
        return False
Пример #6
0
    def __call__(self, resource, obj_id, context):
        res = super(ConcurrencyDialog, self).__call__(resource, obj_id,
            context)

        if res == gtk.RESPONSE_OK:
            return True
        if res == gtk.RESPONSE_APPLY:
            from tryton.gui.window import Window
            Window.create(False, resource, res_id=obj_id,
                domain=[('id', '=', obj_id)],
                context=context, mode=['form', 'tree'])
        return False
Пример #7
0
 def match_selected(completion, model, iter_):
     model, record_id, model_name = model.get(iter_, 2, 3, 4)
     if model == self.menu_screen.model_name:
         # ids is not defined to prevent to add suffix
         Action.exec_keyword('tree_open', {
             'model': model,
             'id': record_id,
         })
     else:
         Window.create(model,
                       res_id=record_id,
                       mode=['form', 'tree'],
                       name=model_name)
     self.global_search_entry.set_text('')
     return True
Пример #8
0
 def _popup_menu_selected(self, menuitem, togglebutton, action, keyword):
     event = Gtk.get_current_event()
     allow_similar = False
     if (event.state & Gdk.ModifierType.CONTROL_MASK
             or event.state & Gdk.ModifierType.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         self._action(action, keyword)
     togglebutton.props.active = False
Пример #9
0
 def _action_favorite(widget, id_):
     event = gtk.get_current_event()
     allow_similar = (event.state & gtk.gdk.MOD1_MASK
                      or event.state & gtk.gdk.SHIFT_MASK)
     with Window(allow_similar=allow_similar):
         # ids is not defined to prevent to add suffix
         Action.exec_keyword('tree_open', {
             'model': self.menu_screen.model_name,
             'id': id_,
         })
Пример #10
0
    def __call__(self, model, id_, context):
        res = super(ConcurrencyDialog, self).__call__()

        if res == Gtk.ResponseType.OK:
            return True
        if res == Gtk.ResponseType.APPLY:
            from tryton.gui.window import Window
            name = RPCExecute('model',
                              model,
                              'read', [id_], ['rec_name'],
                              context=context)[0]['rec_name']
            with Window(allow_similar=True):
                Window.create(model,
                              res_id=id_,
                              name=_("Compare: %s", name),
                              domain=[('id', '=', id_)],
                              context=context,
                              mode=['form'])
        return False
Пример #11
0
 def open_model(path):
     model, path = (path.split('/', 1) + [''])[:2]
     if not model:
         return
     res_id = None
     mode = None
     try:
         view_ids = json.loads(params.get('views', '[]'))
         limit = json.loads(params.get('limit', 'null'))
         name = json.loads(params.get('name', '""'))
         search_value = json.loads(params.get('search_value', '[]'),
                                   object_hook=object_hook)
         domain = json.loads(params.get('domain', '[]'),
                             object_hook=object_hook)
         context = json.loads(params.get('context', '{}'),
                              object_hook=object_hook)
         context_model = params.get('context_model')
         tab_domain = json.loads(params.get('tab_domain', '[]'),
                                 object_hook=object_hook)
     except ValueError:
         return
     if path:
         try:
             res_id = int(path)
         except ValueError:
             return
         mode = ['form', 'tree']
     try:
         Window.create(model,
                       view_ids=view_ids,
                       res_id=res_id,
                       domain=domain,
                       context=context,
                       context_model=context_model,
                       mode=mode,
                       name=name,
                       limit=limit,
                       search_value=search_value,
                       tab_domain=tab_domain)
     except Exception:
         # Prevent crashing the client
         return
Пример #12
0
 def __sig_switch(self, treeview, path, column):
     if column._type == 'button':
         return
     allow_similar = False
     event = gtk.get_current_event()
     if (event.state & gtk.gdk.MOD1_MASK
             or event.state & gtk.gdk.SHIFT_MASK):
         allow_similar = True
     with Window(allow_similar=allow_similar):
         if not self.screen.row_activate() and self.children_field:
             if treeview.row_expanded(path):
                 treeview.collapse_row(path)
             else:
                 treeview.expand_row(path, False)
Пример #13
0
 def activate(menuitem, action, atype):
     rec = load(record)
     data = {
         'model': model,
         'id': rec.id,
         'ids': [rec.id],
     }
     event = Gtk.get_current_event()
     allow_similar = False
     if (event.state & Gdk.ModifierType.CONTROL_MASK
             or event.state & Gdk.ModifierType.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         Action.execute(action, data, context=rec.get_context())
Пример #14
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())
Пример #15
0
 def action_keyword(self, ids):
     if not ids:
         return
     ctx = self.group._context.copy()
     if 'active_ids' in ctx:
         del ctx['active_ids']
     if 'active_id' in ctx:
         del ctx['active_id']
     event = Gtk.get_current_event()
     allow_similar = False
     if (event.state & Gdk.ModifierType.CONTROL_MASK
             or event.state & Gdk.ModifierType.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         return Action.exec_keyword('graph_open', {
                 'model': self.model,
                 'id': ids[0],
                 'ids': ids,
                 }, context=ctx, warning=False)
Пример #16
0
 def _manage_favorites(widget):
     Window.create(self.menu_screen.model_name + '.favorite',
                   mode=['tree', 'form'],
                   name=_('Manage Favorites'))
Пример #17
0
    def __button_press(self, treeview, event):
        if event.button == 3:
            try:
                path, col, x, y = treeview.get_path_at_pos(
                    int(event.x), int(event.y))
            except TypeError:
                # Outside row
                return False
            menu = gtk.Menu()
            copy_item = gtk.ImageMenuItem('gtk-copy')
            copy_item.set_use_stock(True)
            copy_item.connect('activate', lambda x: self.on_copy())
            menu.append(copy_item)
            if self.editable:
                paste_item = gtk.ImageMenuItem('gtk-paste')
                paste_item.set_use_stock(True)
                paste_item.connect('activate', lambda x: self.on_paste())
                menu.append(paste_item)
            menu.show_all()
            menu.popup(None, None, None, event.button, event.time)

            def pop(menu, group, record):
                # Don't activate actions if parent is modified
                parent = record.parent if record else None
                while parent:
                    if parent.modified:
                        break
                    parent = parent.parent
                else:
                    populate(menu, group.model_name, record)
                for col in self.treeview.get_columns():
                    if not col.get_visible() or not col.name:
                        continue
                    field = group.fields[col.name]
                    model = None
                    if field.attrs['type'] == 'many2one':
                        model = field.attrs['relation']
                        record_id = field.get(record)
                    elif field.attrs['type'] == 'reference':
                        value = field.get(record)
                        if value:
                            model, record_id = value.split(',')
                            record_id = int(record_id)
                    if not model:
                        continue
                    label = field.attrs['string']
                    context = field.get_context(record)
                    populate(menu,
                             model,
                             record_id,
                             title=label,
                             field=field,
                             context=context)
                menu.show_all()

            selection = treeview.get_selection()
            if selection.count_selected_rows() == 1:
                group = self.screen.group
                if selection.get_mode() == gtk.SELECTION_SINGLE:
                    model = selection.get_selected()[0]
                elif selection.get_mode() == gtk.SELECTION_MULTIPLE:
                    model = selection.get_selected_rows()[0]
                record = model.get_value(model.get_iter(path), 0)
                # Delay filling of popup as it can take time
                gobject.idle_add(pop, menu, group, record)
            return True  # Don't change the selection
        elif event.button == 2:
            with Window(allow_similar=True):
                self.screen.row_activate()
            return True
        return False
Пример #18
0
 def edit(menuitem):
     with Window(hide_current=True, allow_similar=True):
         Window.create(field.attrs.get("view_ids"), model, id_(record), mode=["form"])
Пример #19
0
    def _exec_action(action, data=None, context=None):
        from tryton.gui.window import Window
        if context is None:
            context = {}
        else:
            context = context.copy()
        if data is None:
            data = {}
        else:
            data = data.copy()
        if 'type' not in (action or {}):
            return

        context.pop('active_id', None)
        context.pop('active_ids', None)
        context.pop('active_model', None)

        def add_name_suffix(name, context=None):
            if not data.get('ids') or not data.get('model'):
                return name
            max_records = 5
            ids = list(filter(lambda id: id >= 0, data['ids']))[:max_records]
            if not ids:
                return name
            rec_names = RPCExecute('model',
                                   data['model'],
                                   'read',
                                   ids, ['rec_name'],
                                   context=context)
            name_suffix = _(', ').join([x['rec_name'] for x in rec_names])
            if len(data['ids']) > len(ids):
                name_suffix += _(',...')
            if name_suffix:
                return _('%s (%s)') % (name, name_suffix)
            else:
                return name

        data['action_id'] = action['id']
        if action['type'] == 'ir.action.act_window':
            view_ids = []
            view_mode = None
            if action.get('views', []):
                view_ids = [x[0] for x in action['views']]
                view_mode = [x[1] for x in action['views']]
            elif action.get('view_id', False):
                view_ids = [action['view_id'][0]]

            action.setdefault('pyson_domain', '[]')
            ctx = {
                'active_model': data.get('model'),
                'active_id': data.get('id'),
                'active_ids': data.get('ids') or [],
            }
            ctx.update(rpc.CONTEXT)
            ctx['_user'] = rpc._USER
            decoder = PYSONDecoder(ctx)
            action_ctx = context.copy()
            action_ctx.update(
                decoder.decode(action.get('pyson_context') or '{}'))
            ctx.update(action_ctx)

            ctx['context'] = ctx
            decoder = PYSONDecoder(ctx)
            domain = decoder.decode(action['pyson_domain'])
            order = decoder.decode(action['pyson_order'])
            search_value = decoder.decode(action['pyson_search_value'] or '[]')
            tab_domain = [(n, decoder.decode(d), c)
                          for n, d, c in action['domains']]

            name = action.get('name', '')
            if action.get('keyword', ''):
                name = add_name_suffix(name, action_ctx)

            res_model = action.get('res_model', data.get('res_model'))
            res_id = action.get('res_id', data.get('res_id'))
            limit = action.get('limit')
            if limit is None:
                limit = CONFIG['client.limit']

            Window.create(res_model,
                          view_ids=view_ids,
                          res_id=res_id,
                          domain=domain,
                          context=action_ctx,
                          order=order,
                          mode=view_mode,
                          name=name,
                          limit=limit,
                          search_value=search_value,
                          icon=(action.get('icon.rec_name') or ''),
                          tab_domain=tab_domain,
                          context_model=action['context_model'],
                          context_domain=action['context_domain'])
        elif action['type'] == 'ir.action.wizard':
            name = action.get('name', '')
            if action.get('keyword', 'form_action') == 'form_action':
                name = add_name_suffix(name, context)
            Window.create_wizard(action['wiz_name'],
                                 data,
                                 direct_print=action.get(
                                     'direct_print', False),
                                 name=name,
                                 context=context,
                                 icon=(action.get('icon.rec_name') or ''),
                                 window=action.get('window', False))

        elif action['type'] == 'ir.action.report':
            Action.exec_report(action['report_name'],
                               data,
                               direct_print=action.get('direct_print', False),
                               context=context)

        elif action['type'] == 'ir.action.url':
            if action['url']:
                webbrowser.open(action['url'], new=2)
Пример #20
0
    def _exec_action(action, data=None, context=None):
        if context is None:
            context = {}
        if data is None:
            data = {}
        else:
            data = data.copy()
        if 'type' not in (action or {}):
            return

        if action['type'] == 'ir.action.act_window':
            view_ids = False
            view_mode = None
            if action.get('views', []):
                view_ids = [x[0] for x in action['views']]
                view_mode = [x[1] for x in action['views']]
            elif action.get('view_id', False):
                view_ids = [action['view_id'][0]]

            action.setdefault('pyson_domain', '[]')
            ctx = {
                'active_id': data.get('id', False),
                'active_ids': data.get('ids', []),
            }
            ctx.update(rpc.CONTEXT)
            eval_ctx = ctx.copy()
            eval_ctx['_user'] = rpc._USER
            action_ctx = PYSONDecoder(eval_ctx).decode(
                    action.get('pyson_context') or '{}')
            ctx.update(action_ctx)
            ctx.update(context)

            domain_context = ctx.copy()
            domain_context['context'] = ctx
            domain_context['_user'] = rpc._USER
            domain = PYSONDecoder(domain_context).decode(
                action['pyson_domain'])

            search_context = ctx.copy()
            search_context['context'] = ctx
            search_context['_user'] = rpc._USER
            search_value = PYSONDecoder(search_context).decode(
                    action['pyson_search_value'] or '[]')

            name = False
            if action.get('window_name', True):
                name = action.get('name', False)

            res_model = action.get('res_model', data.get('res_model'))
            res_id = action.get('res_id', data.get('res_id'))

            Window.create(view_ids, res_model, res_id, domain,
                    action_ctx, view_mode, name=name,
                    limit=action.get('limit'),
                    auto_refresh=action.get('auto_refresh'),
                    search_value=search_value,
                    icon=(action.get('icon.rec_name') or ''))
        elif action['type'] == 'ir.action.wizard':
            Window.create_wizard(action['wiz_name'], data,
                direct_print=action.get('direct_print', False),
                email_print=action.get('email_print', False),
                email=action.get('email'), name=action.get('name', False),
                context=context, icon=(action.get('icon.rec_name') or ''),
                window=action.get('window', False))

        elif action['type'] == 'ir.action.report':
            Action.exec_report(action['report_name'], data,
                    direct_print=action.get('direct_print', False),
                    email_print=action.get('email_print', False),
                    email=action.get('email'), context=context)

        elif action['type'] == 'ir.action.url':
            if action['url']:
                webbrowser.open(action['url'], new=2)
Пример #21
0
    def _exec_action(action, data=None, context=None):
        if context is None:
            context = {}
        else:
            context = context.copy()
        if 'date_format' not in context:
            context['date_format'] = rpc.CONTEXT.get(
                'locale', {}).get('date', '%x')
        if data is None:
            data = {}
        else:
            data = data.copy()
        if 'type' not in (action or {}):
            return

        data['action_id'] = action['id']
        if action['type'] == 'ir.action.act_window':
            view_ids = False
            view_mode = None
            if action.get('views', []):
                view_ids = [x[0] for x in action['views']]
                view_mode = [x[1] for x in action['views']]
            elif action.get('view_id', False):
                view_ids = [action['view_id'][0]]

            action.setdefault('pyson_domain', '[]')
            ctx = {
                'active_model': data.get('model'),
                'active_id': data.get('id'),
                'active_ids': data.get('ids', []),
            }
            ctx.update(rpc.CONTEXT)
            ctx['_user'] = rpc._USER
            decoder = PYSONDecoder(ctx)
            action_ctx = decoder.decode(action.get('pyson_context') or '{}')
            action_ctx.update(context)
            action_ctx.update(ctx)
            action_ctx.update(data.get('extra_context', {}))
            action_ctx['context'] = ctx

            decoder = PYSONDecoder(action_ctx)
            domain = action['pyson_domain']
            order = decoder.decode(action['pyson_order'])
            search_value = decoder.decode(action['pyson_search_value'] or '[]')
            tab_domain = [(n, (action_ctx, d)) for n, d in action['domains']]

            name = False
            if action.get('window_name', True):
                name = action.get('name', False)

            res_model = action.get('res_model', data.get('res_model'))
            res_id = action.get('res_id', data.get('res_id'))

            Window.create(view_ids, res_model, res_id, domain,
                    action_ctx, order, view_mode, name=name,
                    limit=action.get('limit'),
                    search_value=search_value,
                    icon=(action.get('icon.rec_name') or ''),
                    tab_domain=tab_domain,
                    context_model=action['context_model'])
        elif action['type'] == 'ir.action.wizard':
            context = copy.deepcopy(context)
            context.update(data.get('extra_context', {}))
            Window.create_wizard(action['wiz_name'], data,
                direct_print=action.get('direct_print', False),
                email_print=action.get('email_print', False),
                email=action.get('email'), name=action.get('name', False),
                context=context, icon=(action.get('icon.rec_name') or ''),
                window=action.get('window', False))

        elif action['type'] == 'ir.action.report':
            Action.exec_report(action['report_name'], data,
                    direct_print=action.get('direct_print', False),
                    email_print=action.get('email_print', False),
                    email=action.get('email'), context=context)

        elif action['type'] == 'ir.action.url':
            if action['url']:
                webbrowser.open(action['url'], new=2)
Пример #22
0
def translate_view(datas):
    model = datas['model']
    Window.create(False, 'ir.translation', res_id=False,
            domain=[('model', '=', model)],
            mode=['tree', 'form'])
Пример #23
0
    def _exec_action(action, data=None, context=None):
        if context is None:
            context = {}
        else:
            context = context.copy()
        if 'date_format' not in context:
            context['date_format'] = rpc.CONTEXT.get('locale',
                                                     {}).get('date', '%x')
        if data is None:
            data = {}
        else:
            data = data.copy()
        if 'type' not in (action or {}):
            return

        data['action_id'] = action['id']
        if action['type'] == 'ir.action.act_window':
            view_ids = False
            view_mode = None
            if action.get('views', []):
                view_ids = [x[0] for x in action['views']]
                view_mode = [x[1] for x in action['views']]
            elif action.get('view_id', False):
                view_ids = [action['view_id'][0]]

            action.setdefault('pyson_domain', '[]')
            ctx = {
                'active_model': data.get('model'),
                'active_id': data.get('id'),
                'active_ids': data.get('ids', []),
            }
            ctx.update(rpc.CONTEXT)
            ctx['_user'] = rpc._USER
            decoder = PYSONDecoder(ctx)
            action_ctx = decoder.decode(action.get('pyson_context') or '{}')
            action_ctx.update(context)
            action_ctx.update(ctx)
            action_ctx.update(data.get('extra_context', {}))
            action_ctx['context'] = ctx

            decoder = PYSONDecoder(action_ctx)
            domain = action['pyson_domain']
            order = decoder.decode(action['pyson_order'])
            search_value = decoder.decode(action['pyson_search_value'] or '[]')
            tab_domain = [(n, (action_ctx, d)) for n, d in action['domains']]

            name = False
            if action.get('window_name', True):
                name = action.get('name', False)

            res_model = action.get('res_model', data.get('res_model'))
            res_id = action.get('res_id', data.get('res_id'))

            Window.create(view_ids,
                          res_model,
                          res_id,
                          domain,
                          action_ctx,
                          order,
                          view_mode,
                          name=name,
                          limit=action.get('limit'),
                          search_value=search_value,
                          icon=(action.get('icon.rec_name') or ''),
                          tab_domain=tab_domain,
                          context_model=action['context_model'])
        elif action['type'] == 'ir.action.wizard':
            context = copy.deepcopy(context)
            context.update(data.get('extra_context', {}))
            Window.create_wizard(action['wiz_name'],
                                 data,
                                 direct_print=action.get(
                                     'direct_print', False),
                                 email_print=action.get('email_print', False),
                                 email=action.get('email'),
                                 name=action.get('name', False),
                                 context=context,
                                 icon=(action.get('icon.rec_name') or ''),
                                 window=action.get('window', False))

        elif action['type'] == 'ir.action.report':
            Action.exec_report(action['report_name'],
                               data,
                               direct_print=action.get('direct_print', False),
                               email_print=action.get('email_print', False),
                               email=action.get('email'),
                               context=context)

        elif action['type'] == 'ir.action.url':
            if action['url']:
                webbrowser.open(action['url'], new=2)
Пример #24
0
    def _exec_action(action, data=None, context=None):
        if context is None:
            context = {}
        if data is None:
            data = {}
        else:
            data = data.copy()
        if 'type' not in (action or {}):
            return

        def add_name_suffix(name):
            if not data.get('ids') or not data.get('model'):
                return name
            max_records = 5
            rec_names = RPCExecute('model', data['model'],
                'read', data['ids'][:max_records], ['rec_name'])
            name_suffix = _(', ').join([x['rec_name'] for x in rec_names])
            if len(data['ids']) > max_records:
                name_suffix += _(u',\u2026')
            return _('%s (%s)') % (name, name_suffix)

        data['action_id'] = action['id']
        if action['type'] == 'ir.action.act_window':
            view_ids = []
            view_mode = None
            if action.get('views', []):
                view_ids = [x[0] for x in action['views']]
                view_mode = [x[1] for x in action['views']]
            elif action.get('view_id', False):
                view_ids = [action['view_id'][0]]

            action.setdefault('pyson_domain', '[]')
            ctx = {
                'active_model': data.get('model'),
                'active_id': data.get('id'),
                'active_ids': data.get('ids', []),
            }
            ctx.update(rpc.CONTEXT)
            ctx['_user'] = rpc._USER
            decoder = PYSONDecoder(ctx)
            # TODO: comment changes
            action_ctx = context.copy()
            action_ctx.update(decoder.decode(
                    action.get('pyson_context') or '{}'))
            action_ctx.update(ctx)
            action_ctx.update(data.get('extra_context', {}))
            action_ctx['context'] = ctx

            decoder = PYSONDecoder(action_ctx)
            domain = action['pyson_domain']
            order = decoder.decode(action['pyson_order'])
            search_value = decoder.decode(action['pyson_search_value'] or '[]')
            tab_domain = [(n, (action_ctx, d), c)
                for n, d, c in action['domains']]

            name = action.get('name', '')
            if action.get('keyword', '') == 'form_relate':
                name = add_name_suffix(name)

            res_model = action.get('res_model', data.get('res_model'))
            res_id = action.get('res_id', data.get('res_id'))
            limit = action.get('limit')
            if limit is None:
                limit = CONFIG['client.limit']

            Window.create(res_model,
                view_ids=view_ids,
                res_id=res_id,
                domain=domain,
                context=action_ctx,
                order=order,
                mode=view_mode,
                name=name,
                limit=limit,
                search_value=search_value,
                icon=(action.get('icon.rec_name') or ''),
                tab_domain=tab_domain,
                context_model=action['context_model'],
                context_domain=action.get('context_domain', None))
        elif action['type'] == 'ir.action.wizard':
            name = action.get('name', '')
            if action.get('keyword', 'form_action') == 'form_action':
                name = add_name_suffix(name)
            context = copy.deepcopy(context)
            context.update(data.get('extra_context', {}))
            Window.create_wizard(action['wiz_name'], data,
                direct_print=action.get('direct_print', False),
                email_print=action.get('email_print', False),
                email=action.get('email'), name=name,
                context=context, icon=(action.get('icon.rec_name') or ''),
                window=action.get('window', False))

        elif action['type'] == 'ir.action.report':
            Action.exec_report(action['report_name'], data,
                    direct_print=action.get('direct_print', False),
                    email_print=action.get('email_print', False),
                    email=action.get('email'), context=context)

        elif action['type'] == 'ir.action.url':
            if action['url']:
                webbrowser.open(action['url'], new=2)
Пример #25
0
 def edit(menuitem):
     with Window(hide_current=True, allow_similar=True):
         Window.create(field.attrs.get('view_ids'),
                       model,
                       id_(record),
                       mode=['form'])