Hi guys,
What is the correct way to order the Kanban from projects?
The first thing I did was to add a default_order in the arch (project_view.xml) but this didn't change anything:
<record model="ir.ui.view" id="view_project_kanban">
<field name="name">project.project.kanban</field>
<field name="model">project.project</field>
<field name="arch" type="xml">
<kanban class="oe_background_grey">
<kanban default_order="name" />
//irrelevant code</kanban>
</field>
Then I went into project.py and found the method _get_type_common which orders the projects in kanban view. By default its like this:
def _get_type_common(self, cr, uid, context):
ids = self.pool.get('project.task.type').search(cr, uid, [('case_default','=',1)], context=context)
return ids
_order = "sequence, id"
//irrelevant code
So I thought I'd change the _order="sequence,id" to _order="name" but the field 'name' is not in the model project.project..So I thought I'd change it to this:
_order = "type_ids.name"
But then I get the following error:
AccessError
Invalid "order" specified. A valid "order" specification is a comma-separated list of valid field names (optionally followed by asc/desc for the direction)
So, what is the correct way to order on the name of the project in the Kanban view then?
Update: New code now looks like this:
class project(osv.osv):
_name = "project.project"
_description = "Project"
_inherits = {'account.analytic.account': "analytic_account_id",
"mail.alias": "alias_id"}
_inherit = ['mail.thread', 'ir.needaction_mixin','project.project']
_order = 'name asc'
name = fields.char('Account/Contract Name', required=True, track_visibility='onchange')
With kind regards,
Yenthe