我是 openerp 的新手。我想向继承的自定义模块添加新字段,同时我想删除新创建的自定义模块中不需要的字段。我想添加一些详细信息,如母名和父名,并且我想隐藏不需要的职位和网站等详细信息。谁能告诉我。提前致谢
我的代码:
初始化.py
import lead
开放程序.py
{
'name': 'Lead Information',
'version': '0.1',
'category': 'Tools',
'description': """This module is Lead information.""",
'author': 'Nitesh',
'website': '',
'depends': ['base'],
'init_xml': ['lead_view.xml'],
'update_xml': [],
'demo_xml': [],
'installable': True,
'active': True,
'application': True
}
铅.py
from osv import osv
from osv import fields
class cus(osv.osv):
_name = "lead.partner"
_inherit = "res.partner"
_description = "This table is for keeping lead data"
_columns = {
'mothername': fields.char('Mother Name',size=10,required=True)
}
铅视图.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- ===================== This is tree layout =============================-->
<record id="lead_tree" model="ir.ui.view">
<field name="name">Lead</field>
<field name="model">lead.partner</field>
<field name="arch" type="xml">
<field name="mothername"/>
<field name="website" position="attributes"><!--removed / from the end-->
<attribute name="invisible">True</attribute>
</field>
</field>
</record>
<!-- ========================This is Form layout===============================-->
<record id="lead_form" model="ir.ui.view">
<field name="name">Lead</field>
<field name="model">lead.partner</field>
<field name="arch" type="xml">
<field name="mothername"/>
<field name="function" position="attributes"><!--removed / from the end-->
<attribute name="invisible">True</attribute>
</field>
</field>
</record>
<!-- ========================= Action Layout ============================= -->
<record id="action_lead" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="lead_tree"/>
</record>
<!-- ===========================Menu Settings=========================== -->
<menuitem name = "Lead" id = "menu_lis_lab" action="action_lead"/>
</data>
</openerp>