Help

3

add an extra action in the tree view action button

Avatar
Abhijith soman

How can I add an extra functionality to open a wizard view in the action field of product.product model eg: like portal access management in Customer tree view action or like export or delete in Action I need to add another

submenu.


 

Avatar
Discard
2 Answers
1
Avatar
Palkesh Baraiya
Best Answer

Hello Abhijith soman,

You have to Add Window Action for Adding Menu in 'Action'.

Example For Adding Menu in Action.

<act_window id="action_all_customers"
name="All customers"
res_model="res.partner"
view_mode="tree,form"
domain="[('customer', '=', True)]"
context="{'default_customer': True}"
limit="80" />

Example of Menu Structure.

<menuitem id="menu_custom_toplevel" name="My custom menu" />
<menuitem id="menu_custom_left" parent="menu_custom_toplevel" name="This will appear in the left bar" />


2 Comments
Avatar
Discard
Avatar
Abhijith soman
-

Thanks

Avatar
SHIV SHANKAR
-
1
Avatar
Niyas Raphy
Best Answer

Hi,

You can create a new one in the action button like this

<act_window id="id_for_record"
name="Test"
src_model="model_name"
res_model=
"model_name_of_wizard"
view_type="form" view_mode="form"
key2="client_action_multi" target="new"
groups="mention_group_to_restrict_the_access"/>

Then you have to define the form view for the model mentioned in res_model.

To See how it is done in the portal access management case, Go to this path and check :-  odoo-10.0/addons/portal/wizard/portal_wizard_views.xml

<!-- wizard action on res.partner -->
<act_window id="id_for_record"
name="Test"
src_model="model_name"
res_model="model_b"
view_type="form" view_mode="form"
key2="client_action_multi" target="new"
groups="mention_group_to_restrict_the_access"/>

<!-- wizard view -->
<record id="wizard_view" model="ir.ui.view">
<field name="name">Test</field>
<field name="model">model_b</field>
<field name="arch" type="xml">
<form string="Test">
# Define the View
<footer>
<button string="Apply" name="action_apply" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel" />
</footer>
</form>
</field>
</record>

Thanks

1 Comment
Avatar
Discard
Avatar
Abhijith soman
-

Thanks