Odoo Help

1

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

By
Timo Talvitie, Vizucom Oy
on 11/14/13, 7:46 AM 3,526 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 ?

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)

Stats

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