Skip to Content
Menu
This question has been flagged
4 Replies
2456 Views

Hi everyone, 

How to disable The button set to draft of the payment on Odoo 15

Thanks in advance 

Avatar
Discard
Author

Thank you Mr. Ricardo, If we lock posted entries with Hash, as you described, only invoices will be Locked, the payments can be set to draft

Best Answer

Hi,

You can disable the button, by inheriting the Account Payment for view ans set attribute invisible to 1 as below:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_account_payment_form_inherit_extended" model="ir.ui.view" style="color:#e8bf6a;">>
<field name="name">account.payment.form.inherit.extended style="color:#e8bf6a;"></field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_draft']" position="attributes">
<attribute name='invisible'>1</attribute>
</xpath>
</field>
</record>
</odoo>


Make sure that you are adding the correct path for this file in your module manifest file

Hope this will help you

Thank you

Avatar
Discard
Best Answer

you can inherit the view and set the invisible to 1 for the button 

or you can give it a group so other groups cant see it 

or you can also set a which group can do it in python so the button appears but a specific group can use it

Avatar
Discard
Author Best Answer

Hi, 

As I'm a beginner at odoo, could you give me more details, please? 

Avatar
Discard
Best Answer

You can "Lock Posted Entries with Hash" (under accounting->configuration->journals->customer invoices->advanced settings) which will also remove the "reset to draft" button for invoices.

Remembering that this is a decision that must be made with precaution, because after entries are made it becomes irreversible, however necessary according to the accounting law of different countries.

In the hope of being helpful, thank you for comments!

Avatar
Discard