Odoo Help

0

How to Grey-out buttons?

By
Arjun Khode
on 3/17/15, 8:45 AM 509 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>

</record>

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">
                <group>
                    <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"/>
                                           
                </group>
                </form>           
               </field>
        </record>

Can someone help me out?

0
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?

0
chesucr
On 3/17/15, 9:06 AM

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

attrs="{'invisible':[('state','=','done')]}"

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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