Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
20334 Visualizzazioni

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?

Avatar
Abbandona

I have a similar problem...

Risposta migliore

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},
}
Avatar
Abbandona

how to set action button in xml Record model

Risposta migliore

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 ?

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mar 24
3558
7
dic 22
11919
3
giu 21
11231
0
gen 21
2404
2
giu 20
5441