Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
13529 Ansichten

I've been trying to modify project object.

and When I click Assign to field, It shows a list of users with dropdown.

But I'd like to change its order to DESC.

Is there any thing I can do in View?

here is my code below

<record id="project_issue_custom_form" model="ir.ui.view">
    <field name="inherit_id" ref="project_issue.project_issue_form_view"/>
    <field name="model">project.issue</field>
    <field name="arch" type="xml">
        <field name="user_id" position="attributes">
            <attribute name="default_order">sequence desc</attribute>
        </field>
    </field>
</record>

Also I tried in controller

class Project_issue(models.Model):
    _inherit = "project.issue"
    _order = "user_id desc"

But It still doesn't affected.

Avatar
Verwerfen
Beste Antwort

Dear Eric Lee,

Try this:

class res_users(models.Model):
_inherit = "res.users"
_order = "id desc"

and then make your module depends on base module

I hope I helped you...


Avatar
Verwerfen
Autor

I made my module depends on project_issue But Still not working.

are you sure make the above code and do upgrade??

without do any something else.

I am sure the above code will solve your issue..

Autor

Yes I did nothing without code above. And I tried to modify core source in addons/project_issue/project_issue.py to add user_id desc into _order. But That was not working for form view. Of course I update the module and restart the odoo.

Autor

Also When I check its view the field attribute is this <field name="user_id"

context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'project.group_project_user']}"/> Does this attributes can possibly affect not working sorting?

Autor

Does this method work on version 9?

Autor

also when I looked at project_issue.py which is at addons, The project_issue class has _order declared already. I guess _order in custom module doesn't override the variable.

Autor

The way above worked! I should restart service then it worked! Thanks

Beste Antwort

Hai Eric!. Follow the below link desc asc  

_order = 'FIELD_NAME asc


_order = 'FIELD_NAME desc'




Avatar
Verwerfen
Autor

As I wrote above, _order = "user_id desc" doesn't work at all in form view

It will work

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
März 15
5104
1
Feb. 17
2802
0
Juni 24
1179
1
Apr. 24
1518
8
Dez. 22
5210