Hello javier,
As long as I know, this not possible to display a field from another model using the Many2One directly.
Also, you can create a related field in your model, which will automatically retrieve the value of partner_nit. For example:
'responsible_partner_nit': fields.related('responsible_id', 'partner_nit', 'Partner NIT')
And you display this new field in your tree view.
Notes: If you want to filter your list with this new field (sorting or filtering the list), you have to add a store parameter to your field definition (in Python model) so that Odoo will store the value in DB, re-compute it only when needed, and wil be able fo filter on this field:
def _get_session_from_partner(self, cr, uid, ids, context=None) {
return self.pool.get('your.model.session').search(cr, uid, [('responsible_id.id', 'in', ids')], context=context)
}
_columns = {
' responsible_partner_nit': fields.related('responsible_id', 'partner_nit', 'Partner NIT',
store={'your.model.session': lambda *a: self, cr, uid, ids, ctx: ids, ['responsible_id'], 10],
'res.partner':[_get_session_from_partner, ['partner_nit'], 11})
}
Hope it helps you,
Regards