0
我在Windows 7.0上安裝了OpenERP 7.0。我如何在自定義模塊中添加員工姓名字段? 謝謝。將員工姓名添加到OpenERP 7.0中的自定義模塊中
INI的.py
進口筆記本
OpenERP的的.py
{
"name" : "notebook",
"version" : "0.1",
"author" : "Jamil Shah",
"website" : "http://www.asp-aid.org/",
"category" : "Generic Modules/Others",
"depends" : ["hr"],
"description" : "Simple demo module",
"init_xml" : ["notebook_view.xml"],
"demo_xml" : [],
"update_xml" : [],
"active": False,
"installable": True
}
notebook.py
從openerp.osv進口領域,ORM
類筆記本(orm.Model):
_name = "notebook"
_inherit = 'hr.employee'
_description = "Simple Notebook"
_columns = {
'employee_id' : fields.many2one('hr.employee', 'Employee'),
'title' : fields.char('Title', size=30, required=True),
'note' : fields.text('Note'),
'note_date' : fields.date('Date'),
}
筆記本()
notebook_view.xml
<data>
<record model="ir.ui.view" id="notebook_tree_view">
<field name="name">notebook.tree</field>
<field name="model">notebook</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Notebook">
<field name="title"/>
<field name="note"/>
<field name="note_date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="notebook_form_view">
<field name="name">notebook.form</field>
<field name="model">notebook</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Notebook" version="7.0">
<field name="title"/>
<field name="note"/>
<field name="note_date"/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_notebook_form">
<field name="name">notebook</field>
<field name="res_model">notebook</field>
</record>
<menuitem id="notebook_menu"
name="Notebook"
icon="terp-project"
/>
<menuitem id="notebook_sub_menu"
name="Notes"
parent="notebook_menu"
/>
<menuitem id="notebook_menu_mainform"
name="Notes"
action="action_notebook_form"
parent="notebook_sub_menu"
/>
</data>
謝謝,實際上我有一個自定義模塊創建筆記(字段是主題,細節和日期),我想添加員工姓名(誰在創建筆記)並且想要在我的工作中插入員工ID,主題,詳細信息和日期表。你能否詳細說明我將如何實現這一目標? – user2126867 2013-03-07 13:53:21
my 1. __ini__.py 2. __openerp__.py 3.上傳notebook.py和4. notebook_view.xml可以請指導,因爲我無法達到預期的效果。 – user2126867 2013-03-08 10:20:39