2014-01-09 85 views
0

我試圖在購買模塊下添加新的網格結構在POLINE下。One2many和many2one字段顯示:OpenERP v7

我在purchase.py在POLine加入2-字段

'product_id1':fields.many2one('product.product','Product',readonly=True), 
'line_ids1':fields.one2many('POSub.line','sub_id','Sub Line'), 

添加了新的類結構POSubLine

class POSub_line(osv.osv): 
    _name = 'POSub.line'   
    _columns = { 
      'product_id':fields.many2one('product.product','Product',readonly=True,required=True), 
      'S_no':fields.char('Serial Number',size=64,required=True,readonly=True), 
      'unit_price':fields.float('Price'),    
      'other_cost':fielsds.float('Other Cost'),     
      'sub_id':fields.many2one('purchase.order','Serial No',ondelete='cascade'), 
      'tag_no':fields.char('Tag No'),   
      } 
POSub_line() 

purchase_view.xml

<field name="product_id1"> 
<field name="line_ids1">        
<tree string="PO Sub Line" editable="bottom"> 
    <field name="product_id"/> 
    <field name="s_no"/> 
    <field name="tag_no"/> 
    <field name="unit_price"/>  
</tree> 
</field>  

更新模塊時得到錯誤:

openerp.osv.orm: Can't find field 'line_ids1' in the following view parts composing the view of object model 'purchase.order': 
    * purchase.order.form 
    Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model 
    openerp.addons.base.ir.ir_ui_view: Can't render view purchase.purchase_order_form for model: purchase.order 
    Error occurred while validating the field(s) arch: Invalid XML for View Architecture!') 

我該如何解決?

回答

0

您收到錯誤!因爲你錯誤地使用你的領域「line_ids1」在你看來
,而不是你應該寫在那裏這是你的one2many 字段名「line_id」字段名。 這會解決你的錯誤。

+0

字段名稱在我的代碼中匹配,但存在錯誤。 – Silviaa

+0

是的,還有一件事要改善就是關閉你的標籤「」 – Mansi