跳至内容
菜单
此问题已终结
2 回复
9648 查看

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.

 

形象
丢弃
最佳答案

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

Your Welcome !!!

最佳答案

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!

Yes ROB,...

相关帖文 回复 查看 活动
0
12月 22
1618
0
5月 15
3486
3
4月 15
6670
1
3月 15
4712
0
3月 15
3834