Reputation: 16066
Hi I'm using odoo 12 I'd like to remove an action button from a form
and also the share inside the action menu:
I did the following in the inherited view without results:
<record model="ir.ui.view" id="sale_order_log_notes">
<field name="name">sale.order.log.notes</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<attribute name="share">0</attribute>
<attribute name="print">0</attribute>
</xpath>
</field>
</record>
Upvotes: 1
Views: 1872
Reputation: 26738
The Quotation / Order
action was added using the report shortcut to ir.action.report
and the Share button was added using a server action.
There are already two buttons in the corresponding form views to unlink the actions (as mentioned by mingtwo_h9
), a button named Remove from the 'print' menu
to remove the action from the print dropdown menu and Remove Contextual Action
button to remove an action from the dropdown action menu, both buttons call the unlink_action
method, which is implemented separately for ir.actions.report and ir.actions.server and when called sets the binding_model_id
field to False
which hides the action.
It is possible to make a call to a method on a model using the function tag.
It has two mandatory parameters
model
andname
specifying respectively the model and the name of the method to call.
Parameters can be provided using
eval
(should evaluate to a sequence of parameters to call the method with) orvalue
elements (seelist
values).
We need to call the unlink_action
method and pass the action record as a parameter
<function model="ir.actions.report" name="unlink_action"
eval="[ref('sale.action_report_saleorder')]"/>
<function model="ir.actions.server" name="unlink_action"
eval="[ref('sale.model_sale_order_action_share')]"/>
You can also pass parameters using the value
tag (there is an example in l10n_generic_coa)
<function model="ir.actions.report" name="unlink_action">
<value eval="[ref('sale.action_report_saleorder')]"/>
</function>
<function model="ir.actions.server" name="unlink_action">
<value eval="[ref('sale.model_sale_order_action_share')]"/>
</function>
Upvotes: 2
Reputation: 326
The report and action need to be touched directly, not through the view.
For the report, go to Settings
- Technical
- Actions
- Reports
, open the report you need to remove and click the Remove from the "Print' menu
button in the upper right button box of the form.
For the action, it is under Settings
- Technical
- Actions
- Server Actions
, to remove an action, click the REMOVE CONTEXTAL ACTION
button in the header of the form. Note that standard actions like Delete
and Duplicate
cannot be removed this way.
Upvotes: 1