Odoo Help


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.


Open a popup form in create mode

Emanuel Cino
on 11/11/14, 7:16 AM 2,105 views

I added a button in crm.lead form in order to create a new object I defined based on the values of the Lead. I successfully can open a form in a popup (target=new) with predefined values (using the context and default_ values). However, there is no Create button showing up, I can therefore not save my new record. Do you know how to add this Create button ? Here is my XML:

<!-- Create Event action -->
        <record id="action_crm_make_event" model="ir.actions.act_window">
          <field name="name">Create Event</field>
          <field name="type">ir.actions.act_window</field>
          <field name="res_model">crm.event.custom</field>
          <field name="view_type">form</field>
          <field name="view_mode">form</field>
          <field name="target">new</field>

<!-- Button for creating event based on existing Lead -->

<button string="Create Event" name="%(action_crm_make_event)d" type="action"

                 context="{'default_name': name, ...}"/>



| 4 3 5
Hyderabad, India

On 1/24/15, 10:59 AM

I too faced this problem so i did some Research on this and came up with the solution in view.js file under web module:

at line  384, after "

 action.flags = _.defaults(action.flags || {}, {

            views_switcher : !popup && !inline,
            search_view : !popup && !inline,
            action_buttons : !popup && !inline,
            sidebar : !popup && !inline,
            pager : (!popup || !form) && !inline,
            display_title : !popup,
            search_disable_custom_filters: action.context && action.context.search_disable_custom_filters

ADD this line: 

"if (popup){
            action.flags.action_buttons = true;

This will show "save" and "Discard" buttons on 'target:new'.

Hope this will help you.

On 11/11/14, 9:15 AM


Please add one object button with any name except "create" (prefferable) in the form of "crm.event.custom" and in the method just retun True.

It should save the details of that pop up form.

It will work, try it.

This will add the button in the form of the "crm.event.custom". However, if I go on the form view without coming from the "crm.lead" object", I don't want to see this button, as I am not in a popup mode...

Emanuel Cino
on 11/11/14, 9:48 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

2 follower(s)


Asked: 11/11/14, 7:16 AM
Seen: 2105 times
Last updated: 3/14/16, 5:06 AM