Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

How to switch to a tree view in python?

By
AJ Schrafel Paper Corp
on 8/5/13, 5:39 PM 2,087 views

Hello,

I am getting the following error from my function:

Error: QWeb2 - template['TreeView']: Runtime Error: TypeError: dict.field.attrs.modifiers is undefined

I want the function to switch the user's screen to the tree view, using the following code:

    view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','database.sync.display.tree')])
    return {
        'name': ('act_database_sync_display_tree_view'),
        'domain': "[]",
        'view_type': 'tree',
        'view_mode': 'tree',
        'res_model': 'database.sync',
        'view_id': (view_id),
        'nodestroy': True,
        'target': 'current',
        'context': context,
        'type': 'ir.actions.act_window',
    }

What am i not returning that openerp wants to see? I don't need to see a specific record, i just want to switch from the form view back to the tree view when i push a button.

1
Mike Telahun
On 1/18/14, 9:19 AM

If all you want is to return the standard list view of the model, then at the end of your function simply return this:

        return {
            'view_type': 'tree',
            'view_mode': 'tree,form',
            'res_model': 'database.sync',
            'type': 'ir.actions.act_window',
            'target': 'current',
            'context': context
    }

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/5/13, 5:39 PM
Seen: 2087 times
Last updated: 3/16/15, 8:10 AM