We have a franchise as a customer and as they all are treated as single customers for invoicing, the customer names are pretty similar. In the account.invoice view, we therefore want to add a column containing the city of the customer. So I changed account.invoice.tree to include the partner_id.city field as shown below.
<?xml version="1.0"?>
<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="partner_id.city"/>
<field name="commercial_partner_id" invisible="1"/>
<field name="date_invoice"/>
<field name="number"/>
<field name="reference" invisible="1"/>
<field name="name" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="period_id" invisible="1" groups="account.group_account_user"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="user_id" string="Responsible"/>
<field name="date_due"/>
<field name="origin"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="residual" sum="Residual Amount"/>
<field name="amount_untaxed" sum="Untaxed Amount"/>
<field name="amount_total" sum="Total Amount"/>
<field name="state"/>
</tree>
However, upon saving I get this error:
ValidateError
Field(s) `arch` failed against a constraint: Ungültige Ansichtendefinition [Invalid view definition]
Error details:
Das Feld `partner_id.city` existiert nicht [Field does not exist]
Fehler Kontext:
Ansicht `account.invoice.tree`
[view_id: 584, xml_id: account.invoice_tree, model: account.invoice, parent_id: k. A.]
As I have not seen the use of attributes of contained fields, I wonder if this attempt actually works. Can anyone point me in the right direction?