Hi everyone,
I've added a new model with my custom module, and now I want to add a many2many relation field into res.company, but as I click "add" in this relation field it shows up a tree view with just one field from the new model (instead of the three componing the model...). Is there anyway to edit this popup view?
My model has just 3 fields: Postal Code (integer), City (text), Additional Description (text) and I want to show them all when you are selecting multiple values for the many2many field...
This is my actual xml view for res.company:
<field name="arch" type="xml">
<field name="company_registry" position="after">
<field name="zips_asignados" widget="many2many">
<tree>
<field name="zip"/>
<field name="name"/>
</tree>
</field>
<field name="invoicing_company" />
</field>
</field>
But this only shows zip and name into the res.company view, as I click "add" only "name" is showing in the new popup window...
Thanks in advice
SOLUTION:
Make a tree view for new model:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="zips_tree_view" model="ir.ui.view">
<field name="name">zips_tree_view</field>
<field name="model">zips</field>
<field name="arch" type="xml">
<tree string="Zips">
<field name="zip"/>
<field name="name"/>
</tree>
</field>
</record>
</data>
</openerp>
And reference it in the res.company view:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_company_form" model="ir.ui.view">
<field name="name">res.company.form.inherit</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<field name="company_registry" position="after">
<field name="zips_asignados" context="{'tree_view_ref':'zips_tree_view'}" />
<field name="invoicing_company" />
</field>
</field>
</record>
</data>
</openerp>
Can u show fields?....
If you mean if I can show the fields in the "add" button, then the answer is YES :)