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.
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.
<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="value" eval="'ir.actions.act_window,' + str(ref('your_action_name'))" />
<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="value" eval="'ir.actions.act_window,' + str(ref('action_wiz_hospital'))" />
Please let me know, if you have any problem.
Thanks & Regards
Ankit H Gandhi.
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.
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
|Asked: 11/18/15, 6:16 AM|
|Seen: 1053 times|
|Last updated: 12/17/15, 8:45 AM|