action not fired

Asked by Fabio Colognesi

On version 6.1.1 (10 June 2012 build) custom action, defined as follows (see xml code below), won't be executed from web interface. Same action is executed successfully from GTK Client.
In both client the form will be raised. clicking on "Create Standard Bom" button and waiting in debug mode on eclipse in "action_create_normalBom" nothing happens if launched from web Client.

    <record id="plm_component_create_normalbom" model="ir.ui.view">
        <field name="name">plm.relation.normal</field>
        <field name="model">product.product</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
        <form string="Creation of Standard Bom">
            <label string="Are you sure you want to create a new Standard Bom?" colspan="4"/>
            <separator string="" colspan="4" />
            <group colspan="4" col="6">
             <button icon="gtk-cancel" special="cancel" string="Cancel"/>
             <button icon="terp-gtk-go-back-rtl" special="cancel" string="Create Standard Bom" name="action_create_normalBom" type="object"/>
            </group>
        </form>
        </field>
    </record>

    <act_window name="Create Standard Bom"
        res_model="product.product"
        src_model="product.product"
        view_mode="form"
        view_id="plm_component_create_normalbom"
        target="new"
        key2="client_action_multi"
        id="act_create_normalBom"/>

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Web (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #1015662.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#1

Fabio,

There is no bug, but you miss a technical point here.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#2

Fabio,

You should not have specified 'special="cancel"' in the second button which is going to call your action.

When you specify 'special="cancel"', system understands to close the form.

Additionally, opening the target model as 'product.product' is also a bad idea, which will in turn end up as an 'integrity' error due to positive action(2nd button) will try to create a record and will not find values for mandatory fields!

Hope this helps.

Regards,
Serpent Consulting Services.
http://www.serpentcs.com

Revision history for this message
Fabio Colognesi (fabio-colognesi) said :
#3

Hello Serpent Consulting Services,

Thanks for your prompt answer. Unfortunately it doesn't solve my issue.
Removing 'special="cancel"' specification for the "action" button, effectively it starts to create a component !!

I would have an action to apply to selected Product item(s), this action should open a popup to ask "Continue" or "Cancel", if you press "Cancel" it stops closing popup, if you press "Continue" it executes code function named "action_create_normalBom" and close the popup.

I'm really confused, in GTK Client (both 6.1.1 version) it works fine, exactly as I thought and described here.

Why, in web Client, have I a different behaviour? What am I doing of wrong?

Many thnks in advance.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#4

Fabio,

Opening the target model as 'product.product' is not the way to do, instead, you can create a temporary model and it can call the
action_create_normalBom and close the pop up.

Follow the said idea, it will work in both the clients.

Thanks.

Can you help with this problem?

Provide an answer of your own, or ask Fabio Colognesi for more information if necessary.

To post a message you must log in.