1
votes

There's a field of line_ids in the class of 'purchase.requisition' :

  'line_ids' : fields.one2many('purchase.requisition.line','requisition_id',
               'Products to Purchase',states={'done': [('readonly', True)]}),

And I add a many2one field to 'purchase.order.line' :

 'requisition_line_id': fields.many2one('purchase.requisition.line' ,
                 u'Requisition Line',readonly = True ,  ondelete = 'restrict' ),

Now , how can I display then name field of 'purchase.requisition' in the view of 'purchase.order.line' ?

2

2 Answers

3
votes

You can you fields.related.

Example :

class hr_employee(osv.osv):
    _name = "hr.employee"

    _columns = {
        'address_id': fields.many2one('res.partner.address', 'Working Address'),
        'city': fields.related('address_id', 'city', type='char', string='City'),
    }

Then after add moduel_view.xml at appropriate place.

<field name="city" />

Here you see an example of fields.related.

Now similar try to fix your problem.

I hope this will be helpful for you.

0
votes

Goto View Inheritance It will help you a lot.