我目前正在使用 Open ERP。我想用一些添加的字段来扩展客户/组织表单。
我的印象是客户对象模型是 res.partner。
到目前为止,这是我的代码:
from osv import fields, osv
class starstream_customers(osv.osv):
_name = 'starstream.customers'
_inherit = 'res.partner'
_table = 'res_partner'
_columns = {
'caller_id': fields.char('Caller ID',size=128),
'rating': fields.selection([
('none', '--None--'),
('shutdown', 'Shutdown'),
('aquired', 'Aquired'),
('active', 'Active'),
('cancelled', 'Project Cancelled')
], 'Rating'),
'industry': fields.char('Industry',size=265),
'type':fields.selection([
('supplier', 'Supplier'),
('customer', 'Customer'),
('old_customer', 'Old Customer'),
('supplier', 'Supplier'),
('customer_support_team', 'Customers Support Team'),
('none', '--None--'),
], 'Type'),
'invoice_address': fields.char('Invoice Address',size=512),
'employees': fields.integer('Employees'),
}
starstream_customers()
我的视图文件:
<openerp>
<data>
<record model="ir.ui.view" id="view_starstream_customers">
<field name="name">starstream.customers.tree</field>
<field name="model">starstream.customers</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="rating"/>
</page>
</field>
</record>
</data>
</openerp>
现在,我只是想在评级字段中添加,直到它工作为止。
每次我尝试重写这个时,我都会得到:
TypeError: The model "('res.partner',)" specifies an unexisting parent class "('res.partner',)"
You may need to add a dependency on the parent class' module.
我看不到哪里出错了,有人可以帮忙吗?