I have created a new module
.py
from openerp.osv import fields, osv
class carbuy(osv.osv):
_name = "car.buy"
_description = "car Customers"
_columns = {
'name' : fields.char('Car Model',required=True),
'cname' : fields.char('Customer Name', required=True),
'bprice' : fields.float('Bought Price', required=True),
'sprice' : fields.float('Sold Price' , required=True),
}
.xml
<openerp>
<data>
<record id="car_buy_form" model="ir.ui.view">
<field name="name">car.buy.form</field>
<field name="model">car.buy</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="carbuy customer details">
<sheet>
<group>
<field name="name"/>
<field name="cname"/>
<field name="bprice"/>
<field name="sprice"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="carbuy_tree_view">
<field name="name">carbuy.tree</field>
<field name="model">car.buy</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="carbuy customer details">
<field name="name"/>
<field name="cname"/>
<field name="bprice"/>
<field name="sprice"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="car_buy_form">
<field name="name">carbuy Customers</field>
<field name="res_model">car.buy</field>
</record>
<menuitem name="carBuy" id="carbuy_menu"/>
<menuitem name="carbuy" id="carBuy_group_menu" parent="carbuy_menu"/>
<menuitem name="carbuy Customers" parent="carBuy_group_menu" id="carbuy_menu_mainform" action="car_buy_form"/>
</data>
</openerp>
I have call the customer name as the many2one field.
so that it has to show the customer details or customer name which is in Accounting.
In simple when I click the customer name field in my new module it has to show the details or name of the customers in the Customers section of accounting.
For example:
In hr_attendance the field employee_id
'employee_id': fields.many2one('hr.employee', "Employee", required=True, select=True)
It calls the employees in the class hr_employee when the employee field is clicked in hr_attendance.
Likewise I want to call the customer name from accounting to my new module.
Give me some suggestions.
Thanks.