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.

5

[closed] open a form in a specified state : edit/browse

By
Nicolas Clavier
on 2/27/13, 5:08 AM 5,783 views

When opening a form from an function returning an action code as in the example below, I was wondering how could I explicitly specify the state of the form, wether it's in edit or browse mode ?

'type': "ir.actions.act_window"
'res_model': 'model'
'view_type': 'form'
'view_mode': 'form'
'target': 'current'
'context': context

I noticed the following:

  • 'target' = 'new'opens in edit mode (as when creating wizards..)
  • 'target' = 'current' opens in browse mode (as in regular form views)
  • context does not seem to contain any specific instructions

Thanks for your time. Nicolas

Works ! Thanks for saving me hours ))

Nicolas Clavier
on 2/27/13, 6:11 AM

@Nicolas: please mark the answer as correct (below the vote). Also, I converted your thanks to a comment (I couldn't move it under the answer though), because that's not an answer, only real answer should be posted as such.

Camptocamp SA, Guewen Baconnier - Software Developer, Camptocamp
on 2/27/13, 6:22 AM
7

Andreas Brueckl

--Andreas Brueckl--
5056
| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 2/27/13, 5:57 AM

You can set 'target' = 'inline'. This opens a form in edit mode.

Also needed this, thank you!

Paul Catinean
on 7/2/13, 8:48 AM

Andreas, when returning an action that has 'target' = 'inline' in the case of the sale.order it indeed opens it in edit mode but the top menu (Create, Edit, Save,Print, More) disapears alltogether.Do you have any idea why that happens and how to prevent it?

Paul Catinean
on 10/4/13, 9:29 AM

This solution is not valid, because the top menus disappear from view. Is there any other way? thanks in advance.

Rafael Valle
on 4/7/14, 2:01 PM

me too, i've tried to look at base/ir/ir_actions.py but still get stucked.

PT SIVI
on 7/2/14, 4:52 AM
3
Joerg Petke
On 3/16/16, 11:26 AM

Found this way in calendar module and it works fine :-)

Add following key into the action dict:

'flags': {'form': {'action_buttons': True, 'options': {'mode': 'edit'}}},
0

Alexandre Fayolle - Camptocamp

--Alexandre Fayolle - Camptocamp--
1109
| 5 6 8
Le Bourget-du-Lac, France
--Alexandre Fayolle - Camptocamp--

Alexandre has been working on Odoo at Camptocamp since 2012 as a project manager and technical lead. He is an active actor in the Odoo Community (github projects, mailing lists, IRC...), and wants to build a better ecosystem for Odoo developers. He is a member of the Odoo Community Association board and an active contributor to the OCA projects.

Alexandre Fayolle - Camptocamp
On 1/22/16, 8:19 AM


0
Mohamed Essakali
On 12/9/14, 9:43 AM

I developped this module to achieve that.  install it and use 'target' : 'current_edit' to open form in edit mode 

Hi, I install your module but I have this error: except_orm: (u'ValidateError', u'The value "current_edit" for the field "ir_act_window.target" is not in the selection') Can you help me?

Luís
on 2/4/15, 5:52 AM

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

4 follower(s)

Stats

Asked: 2/27/13, 5:08 AM
Seen: 5783 times
Last updated: 3/16/16, 11:26 AM