Python One2many和manyOne字段显示:OpenERP v7

Python One2many和manyOne字段显示:OpenERP v7,python,openerp,Python,Openerp,我正在尝试在POLine下的购买模块中添加新的网格结构 我在POLine中添加了2个字段 'product_id1':fields.many2one('product.product','Product',readonly=True), 'line_ids1':fields.one2many('POSub.line','sub_id','Sub Line'), 在purchase.py中为POSubLine添加了新的类结构 class POSub_line(osv.osv): _nam

我正在尝试在POLine下的购买模块中添加新的网格结构

我在POLine中添加了2个字段

'product_id1':fields.many2one('product.product','Product',readonly=True),
'line_ids1':fields.one2many('POSub.line','sub_id','Sub Line'),
在purchase.py中为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\u 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>    

如何解决?

由于您在视图中错误地使用了字段“line_ids1”,因此出现了错误
相反,您应该在那里写上“line_id”字段名,这是您的one2many 字段的名称。
这将解决您的错误。

是的,还有一件需要改进的事情是关闭您的标签“”
 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!')