Odoo Help


1 Answer

Qutechs, Ahmed M.Elmubarak ซูดาน

--Qutechs, Ahmed M.Elmubarak--
--Qutechs, Ahmed M.Elmubarak--

Qutechs, Ahmed M.Elmubarak ซูดาน
9/5/14 07:24


Lets break down you question to:

  • add undelete action to More menu and linking it to the function
  • add your undelete button to the header of the form
  • hide delete on More menu

for now I'll go for the first one...

You can add an item to the More menu by using ir_set tag or ir.values model since the second one is the famous let us try it.

if you want the function to be invoked directly when the user press the undelete label "I mean without a pop up verification window like "are you sure ....." " then we have to link it with a server action.

a server action can be defined in xml like:

<record id="action_server_name" model="ir.actions.server">
        <field name="type">ir.actions.server</field>
        <field name="condition">True</field>
        <field name="state">code</field>
        <field name="model_id" ref="model_name_name"/>
        <field eval="5" name="sequence"/>
        <field name="code">self.method_name(cr, uid, context)</field>
       <field name="name">Your Name</field>

the ref="model_name_name" is your model_id reference So if your model is test_model you have to make it like model_test_model

the self.method_name it'll by your function to be invoked in your case it'll by self.unlink(params ....)

then we have to link this action with the ir.values and it could like:

<record model="ir.values" id="action_your_action_id" >
        <field name="key2" eval="'client_action_multi'" />
        <field name="model" eval="'test.model'" />
        <field name="name">Undelete</field>
        <field name="value" eval="'ir.actions.server,%d'%action_server_name"/>
        <field name="object" eval="True" />

If you want to pop up a window you have to make a wizard to achieve this, and put your button in it to invoke the function and then you have to link the wizard action to the ir.values and it'll be like

<record model="ir.values" id="values_id">
        <field name="name">Undelete</field>
        <field name="key2">client_action_multi</field>
        <field name="value" eval="'ir.actions.act_window,' + str(ref('action_wizard_id'))" />
        <field name="key">action</field>
        <field name="model">model.model</field>

I hope this could helps you


Ask a Question
Keep Informed
0 ผู้ติดตาม
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