Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
20321 Vizualizări

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?

Imagine profil
Abandonează

I have a similar problem...

Cel mai bun răspuns

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},
}
Imagine profil
Abandonează

how to set action button in xml Record model

Cel mai bun răspuns

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 ?

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
mar. 24
3506
7
dec. 22
11880
3
iun. 21
11201
0
ian. 21
2381
2
iun. 20
5419