콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
13793 화면

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.

아바타
취소
베스트 답변

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...


아바타
취소
작성자

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..

작성자

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.

작성자

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?

작성자

Does this method work on version 9?

작성자

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.

작성자

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

베스트 답변

Hai Eric!. Follow the below link desc asc  

_order = 'FIELD_NAME asc


_order = 'FIELD_NAME desc'




아바타
취소
작성자

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

It will work

관련 게시물 답글 화면 활동
1
3월 15
5416
1
2월 17
3039
0
6월 24
1453
1
4월 24
1825
8
12월 22
5629