This question has been flagged
1 Reply
6652 Views

I have to create a new report of which content will vary depending on user input: select a finished product in manufacturing orders.

I have though of creating a new wizard for product selection an then generate a report. However I am having issues with the action which makes the call between mrp.production view to the wizard, which has to show a link from the model view. Here is the content I have added to my_module_view.xml

<record id="action_print_manufacturing_order" model="ir.actions.act_window">
        <field name="name">Print Manufacturing Order</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">mymodule.mrp.pruduction.report</field>
            <field name="domain">[('id','in',active_ids)]</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>

        <ir_set>
        <field name="key" eval="'action'"/>
        <field name="key2" eval="'client_action_multi'"/>
        <field name="models" eval="['mrp.production']"/>
        <field name="name">Print Manufacturing Order</field>
        <field name="value" eval="'ir.actions.act_window,'+str(action_print_manufacturing_order)"/>
        <field name="isobject" eval="True"/>
        <field name="replace" eval="True"/>
    </ir_set>

And my wizard class (unfinished):

class ecocap_mrp_report(osv.osv_memory):
    _name = "ecocap.mrp.pruduction.report"
    _description = "Manufacturing order report"

    _columns = {
                  #Columns
              }

After updating my module, there is no link in the mrp.production view to the newly created action. I have been able to manually create this link in Settings > Customization > Low Level Objects > Actions > Actions Bindings. However I would prefer if I could create the action binding from _view.xml file but obviously there is something missing I can't come up with.

Thanks,

Avatar
Discard
Best Answer

Try this:

<act_window
    domain="[('id','in',active_ids)]"
    id="act_print_manufacturing_order"
    name="Print Manufacturing Order"
    res_model="mymodule.mrp.pruduction.report"
    src_model="mrp.production"
    view_id="your_wizard_form_view_id"
    target="new"/>

This will add wizard in More of form view.

Avatar
Discard
Author

It worked, thanks!