0
votes

I am trying to add new grid structure in Purchase module under POLine.

I have added 2 fields in POLine

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

Added the new class structure for POSubLine in purchase.py

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>    

when Updating the module getting the error:

 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!')

How do i resolve?

1

1 Answers

0
votes

you are getting error coz you have wrongly used your field "line_ids1" in your view
instead you should write "line_id" field name over there which is your one2many field's name. This will solve your error.