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.

1

Opening a view with 'target':'new' loses the create button

By
Timo Talvitie
on 11/14/13, 7:46 AM 3,155 views

I have a piece of Python code that redirects the user to another view when he/she clicks a button. The redirecting is done as follows:

    view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr_timesheet', 'hr_timesheet_line_tree')
    view_id = view_ref and view_ref[1] or False

    return {
        'type': 'ir.actions.act_window',
        'name': 'Timesheets',
        'view_mode': 'tree',
        'view_id': view_id,
        'res_model': 'hr.analytic.timesheet',
        'context': context,
     }

This opens the new view into the current window like this:

image description

That works fine, but it would be better if the window opened in an overlay instead. I then added 'target':'new' to the return statement's dictionary, and the result appears like this:

image description

So the overlay opens up, but the create button is missing so you can only access the current rows, not add new ones. Any ideas what could be causing this?

I have a similar problem...

Emanuel Cino
on 11/11/14, 7:04 AM
1
Nicolas PIGANEAU
On 3/18/15, 6:40 AM

Add a flags parameter to the action window:

return {
     'type': 'ir.actions.act_window',
     'name': 'Timesheets',
     'view_mode': 'tree',
     'view_id': view_id,
     'res_model': 'hr.analytic.timesheet',
     'context': context,
     'flags': {'action_buttons': True},
}

how to set action button in xml Record model

Annadurai
on 8/25/16, 6:54 AM
0

Hello,

I have a similar question, I want to display the number of record (top right) and the next/previous button.

How can I do this ?

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

3 follower(s)

Stats

Asked: 11/14/13, 7:46 AM
Seen: 3155 times
Last updated: 3/18/15, 6:40 AM