Odoo Help

Welcome!

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.

1

How to assign action into the"More" menu

By
Dr Obx
on 11/18/15, 6:16 AM 1,043 views

Hi guys,

I would like to assign an action to the button in "More" menu. I managed to create a button and it opens a form but instead of form i would like to run state change procedure so for example if state is dispatched i want select all of them then open menu and apply action change_state to archived.

 

4

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 11/18/15, 9:39 AM

Dear Dr Obx,

You need to create a wizard and you will select all record from wizard

and also create button inside wizard form view

when press the button at that time state will be change of order which are selected

Using below code you will create action in 'More' menu.

Syntax:

<record model="ir.values" id="any_name">
<field name="model_id" ref="module_name_model_model_name" />
<field name="name">Any String</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('your_action_name'))" />
<field name="key">action</field>
<field name="model">model.name</field>
</record>


Example:

<record model="ir.values" id="wiz_hospital_values">
<field name="model_id" ref="hospital_management.model_patient_patient" />
<field name="name">Wiz Hospital</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_wiz_hospital'))" />
<field name="key">action</field>
<field name="model">patient.patient</field>
</record>

Please let me know, if you have any problem.

Thanks & Regards

Ankit H Gandhi.

Thank you Ankit

Dr Obx
on 11/18/15, 10:49 AM

Your Welcome !!!

Ankit H Gandhi(AHG)
on 11/19/15, 12:09 AM
2

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 11/18/15, 9:29 AM

Rob,

On clicking on menu under more, you have to get a form opened as a default functionality of odoo, but u can customize it in your way as:

in the new opened window(of new object) you can use it as a message box and prompt the user to change state by giving some message like;

"You are about to change the state of the selected [your object], Are you sure to continue?"

and then on click of button, you can do your functionality of changing the state  of the recordsw of  your object...

You can get the selected records ids in 'context' of current object(object of which your popped up form is related to) as "active_ids"

There might be some other direct method too, but its one of the way to customize wat you have according to your need.

Regards,    

Pawan

Are you there Pawan ? I need your advice, URGENT!

Dr Obx
on 12/17/15, 6:59 AM

Yes ROB,...

Pawan
on 12/17/15, 10:22 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

1 follower(s)

Stats

Asked: 11/18/15, 6:16 AM
Seen: 1043 times
Last updated: 12/17/15, 8:45 AM