Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to visible and invisible fields of the basis of selection fields in OpenERP(Odoo-8)?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.17k
    Comment on it

    In OpenERP first, create custom module and then create object in your own module and put your own module in your OpenERP server.


    Follow these step given below

    Step1- First create module like as a test and then create file like as a file in test module and then create object and fields in file and pass this file in file.

    Using this code given below

    from openerp import api
    from datetime import datetime
    from import _
    class customer_visibles(osv.osv):    
        _name = "customer.visibles "
        _columns = {
                    'customer': fields.many2one('res.partner', readonly=True, string="Customer Name", required=True),
                    'transaction_type': fields.selection([('deposit', 'Deposit'),('withdraw', 'Withdrawal')], string="Transaction Type"),
                    'deposit': fields.float("Amount"),


    Step2- Then, create another file like as a test.xml file in your existing module and pass this file and ones this done, relate all fields in file .

    Using this code given below

    <?xml version="1.0" encoding="UTF-8"?>
      <record id="customer_transaction_view" model="ir.ui.view">
                <field name="name">customer_visibles</field>
                <field name="model">customer.visibles</field>
                <field name="arch" type="xml">
                    <form string="Customer">
                        	<field name="customer"/>
                            <field name="deposit" attrs="{'invisible': [('transaction_type','!=','deposit')]}" style="width:50%%"/>
                            <field name="withdraw" attrs="{'invisible': [('transaction_type','!=','withdraw')]}" style="width:50%%"/>

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: