Skip to Content
Menu
This question has been flagged
2 Replies
2075 Views

I have Odoo v8

In the list view i want a value(vat) from the partner that is selected in the invoice.

I have tried  <field name="partner_id.vat"/> but that doesn't work.

partner_id is a many to one field.  Vat is a char field.

How can i do that?


Avatar
Discard
Best Answer

You can create a related (v7) / related (v8) field for that.

Ex:

# For older version style
_columns = {
'partner_vat': fields.related('partner_id.vat', type='char', string='Vat')
}
# For API version style
partner_vat = fields.Char(related='partner_id.vat', string='Vat')

Add this field in tree view.

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com  website: http://www.erpharbor.com
Avatar
Discard
Author Best Answer

Sorry i am new to this.

Where can i make a related field? 

Avatar
Discard

In your custom module, inherit account.invoice object and add the related field as I said in my answer.

Author

Do i need a custom module for that?

Yes, you will have to create a custom module for that.