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)