Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to Grey-out buttons?

Arjun Khode
on 3/17/15, 8:45 AM 330 views

Hi, I have a button that registers payment from a customer.

I want it to be greyed out from the view once the payment has been registered. How to do that?

This is my button code:

<record id="register_payment_button_action" model="ir.actions.act_window">

<field name="name">Register Payment</field>

<field name="res_model">account.voucher</field>

<field name="view_type">form</field>

<field name="view_mode">form</field>

<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>

<field name="context">{'type':'receipt'}</field>

<field name="view_id" ref="account_voucher.view_vendor_receipt_form"/>

<!-- <field name="view_id" ref="account_voucher.view_vendor_receipt_dialog_form"/> -->

<field name="target">new</field>


View Code:

    <record id="record_form_view" model="ir.ui.view">       
            <field name="name">record.form.view</field>
            <field name="view_type">form</field>
            <field name="model">record</field>
            <field name="arch" type="xml">
                <form string="Record">
                    <field name="investment_id"/>
                    <field name="investor_id" domain="[('is_investor','=',True)]"/>
                    <field name="start_date"/>
                    <!--  <field name="end_date"/> -->
                    <field name="roi"/>
                    <field name="amount"/>
                    <field name="returns"/>
                    <!-- <button name="action_compute_returns" string="Compute Returns" type="object"/> -->
                    <button name="%(register_payment_button_action)d" context="{'default_amount': amount,'default_partner_id': investor_id'}" string="Register Payment" type="action"/>
                    <button name="%(pay_investor_button_action)d" context="{'default_amount': returns,'default_partner_id': investor_id'}"  string="Pay Investor" type="action"/>

Can someone help me out?

Arjun Khode
On 3/18/15, 2:58 AM

Hi chesucr, thanks for your help.

How can I let the button know that the state has been now changed to 'done'?

Its necessary for me to have partial payments in my register payment button. So that after 'n' number of payments when the full amount has been paid, then the state should become 'Done' and button should be greyed out or invisible.

My button action is in model 'account.voucher' and my amounts to be paid are in model 'record'. How can I link the two and write a condition accordingly?

On 3/17/15, 9:06 AM

 You can put the button invisible instead disable. You can add something like this in the button


Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 3/17/15, 8:45 AM
Seen: 330 times
Last updated: 3/18/15, 2:58 AM