Odoo Help


How do I create a custom copy action in the More.. menu of a form?

Miku Laitinen
on 5/27/14, 8:54 AM 1,292 views

I have two copy methods for a sales quotation. One that copies the quotation without fields called external_ref and external_version and one that creates a new version of the quotation by sparing the external_ref and dropping the external_version.

When I use normal buttons in the quotation form, this solution works exactly as intended.

The problem is that I don't want the buttons to be located in the toolbar of the form. Mainly because there are already 4 buttons (in the draft state) and I don't want to confuse the users by putting one copy action in the toolbar and another (the default) in the 'More...' menu. So, I want the "Create a new version" action under the More... menu.

Here's something I got working.. almost:

<record id="ir_server_action_quotation_new_version" model="ir.actions.server">
            <field name="name">Create a new version of a quotation</field>
            <field name="type">ir.actions.server</field>
            <field name="model_id" ref="model_sale_order"/>
            <field name="state">code</field>
            <field name="code">self.new_version(cr, uid, context.get('active_ids'), context=context)</field>
<record id="ir_quotation_new_version" model="ir.values">
            <field name="name">Create New Version</field>
            <field name="action_id" ref="ir_server_action_quotation_new_version"/>
            <field name="value" eval="'ir.actions.server,' + str(ref('ir_server_action_quotation_new_version'))"/>
            <field name="key">action</field>
            <field name="model_id" ref="model_sale_order"/>
            <field name="model">sale.order</field>
            <field name="key2">client_action_multi</field>

So I got the "new version" action in the More... menu, but two problems remain:

  1. The new version action is visible in the tree view, and I only want it to be visible in the form
  2. A new version of the quotation is created as intended, but the browser doesn't navigate to the newly created quotation's form view (probably because the action is a server action)

The "new version" action should be visible whenever the default "copy" action is. And it must perform just like the copy action, only calling a different method.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/27/14, 8:54 AM
Seen: 1292 times
Last updated: 3/16/15, 8:10 AM