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.

0

Open a form view for a specific record OR go back to previous view

By
Pau Ubach
on 10/9/14, 10:43 PM 1,836 views

Hi,

I have a tree view, where I select a record. When I select it the window changes to a form to can see and edit this record.

Here I can click a button that opens a tree in the current window (can't use a popup because I need to be able to use filters), when I click a record on this tree I execute a function, and I would like to go back to the previous form view

I'm trying to use this in the function:

return {
                'type': 'ir.actions.act_window',
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': context['active_model'],
                'target': 'current',
                'context': context,
                'domain': [('quot_id','=',context['active_id'])]
            } 

But it doesn't work, I get the following error:

Uncaught TypeError: Cannot read property '1' of undefined

http://localhost:8069/web/static/src/js/view_form.js:3285

And besides, I suspect defining the domain, as in here wouldn't allow me to navigate between records, as this one would be the only one in the domain.

 

1
Pau Ubach
On 10/10/14, 12:45 AM

Solved using res_id. I don't know why it doesn't appear in OpenERP documentation

return {
                'type': 'ir.actions.act_window',
                'view_type': 'form',
                'view_mode': 'form,tree',
                'res_model': context['active_model'],
                'target': 'current',
                'context': context,
                'res_id': context['active_id'],
                'domain': [('pr_id','=',pl_new.pr_id['id'])],
            } 

The main problem now is that in the header, where it says where I am (history of navigation view) gets longer and longer

Request Project / P4 / Quotations / QN4 / Price List / QN4 / Price List /............. QN4 / Price List / QN4 / Price List / QN4

So I'd really need to be able to go back instead of adding this view. 

 

I'll raise a new question, as I want to leave the res_id solution available.

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: 10/9/14, 10:43 PM
Seen: 1836 times
Last updated: 3/16/15, 8:10 AM