Skip to Content
Menu
This question has been flagged
1 Atsakyti
6078 Rodiniai

I have a custom field in res.partner to indicate whether they like to get their invoices via E-Mail or via post. Now I want this information to show in the TreeView of the invoices as a new column. 


<tree colors="blue:state == 'draft';black:state in ('proforma','proforma2','open');gray:state == 'cancel'" string="Invoice">
<field name="partner_id" groups="base.group_user"/>
[...]
<field name="amount_total" sum="Total Amount"/> 
<field name="partner_id.x_invoice_by"/>
<field name="state"/>
</tree>

View account.invoice.tree


This results in an error (Field "partner_id.x_invoice_by" does not exist). I tried to include the information with a reference field with this selection: [('res.partner', 'partner_id.x_invoice_by')] , but had no luck either, the column appears, but is empty for all invoices.

EDIT: I'm using Odoo 8.0 if that matters


Portretas
Atmesti
Best Answer

Hello,

you can use related="product_id.x_invoice_by" attribute, in the definition of a new field in the account.invoice

e.g:

your_name: fields.Char(related="product_id.x_invoice_by", string="Your Name")

then use this field in the tree view.

you can check Related fields section in this documentation 

Thanx

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
birž. 22
612
0
liep. 20
4510
0
kov. 19
3497
0
kov. 15
4424
2
vas. 24
2609