Hello there,
Here is my code to customize « external identifiers » view. I added a ID column.
But when I add a new column like this in a view, I CAN NOT sort lines according to this new column. If I click the header of the table, nothing arrives. How could it work?
Also, how could I get the little triangle icon in the header when the column is sorted? (see the triangle at the right of Model Name)
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="base.view_model_data_list" model="ir.ui.view">
<field name="model">ir.model.data</field>
<field name="arch" type="xml">
<tree string="External Identifiers">
<field name="id"/>
<field name="complete_name"/>
<field name="display_name"/>
<field name="model" groups="base.group_no_one"/>
<field name="module" invisible="1"/>
<field name="res_id"/>
</tree>
</field>
</record>
</data>
</openerp>
Thanks
I would like to know how to make an added column sortable, too!
@Jeff, in general all stored columns are sortable. I've just learned that in v8 the ID column is not. So, as long as your column is stored in the database you can just add the field into the tree view and it will be sortable.
I added the "Internal Reference" (default_code) field to the Product list view. Unfortunately, it remains unsortable. I can click on the header cell all I want, but it doesn't work. There must be some way that you have to designate the column as sortable.
Ah! I looked in the database, and I see that "default_code" is actually stored in product.product, not product.template, which is the base table for the Products list view. Is that why it's not sortable? It's not a member of the base table?
I guess so. However I'm amazed if you can display default_code in a view based on product.template. New things to learn everyday. Thanks for sharing.