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.22k
    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 test.py file in test module and then create object and fields in test.py file and pass this file in __init__.py file.

    Using this code given below

    from openerp import api
    from datetime import datetime
    from openerp.tools.translate 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"),
    
     }
    customer_visibles()

     

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

    Using this code given below

    <?xml version="1.0" encoding="UTF-8"?>
    <openerp>
        <data>
      <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">
                    <header>
                    </header>
                      <sheet>
                      	<group>
                        <group>
                        	<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%%"/>
    <!--           
                          </group>
                  </sheet>
               </form>
             </field>
     </record>
    </data>
    </openerp>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: