Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2386 Lượt xem

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?


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Sorry i am new to this.

Where can i make a related field? 

Ảnh đại diện
Huỷ bỏ

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

Tác giả

Do i need a custom module for that?

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