Change order of party tree

hello,

i tried to change order on party.party i found

and i tried

    _order_name = 'id'
    _order = [('id', 'DESC')]

in party.py in
class Party(DeactivableMixin, ModelSQL, ModelView, MultiValueMixin):

without succes…

what did i miss ?

thanks

The ModelSQL._order is the default order when no other order is defined like by the ir.action.act_window or the One2Many.order etc…

It is to replace the field to use when ordering by field referring this model.

So where do you want to change the default order (because you can always click on the column to change the order).

Yes i know, but i do not want to see the id on the tree as id is not use IRL (just a sql thing).
I would like to see it on the tree view on party. so i tried to get that reverse order everywhere for parties because in the everyday life the last entered are the most. I could add date column in tree to sort by but is is less-happy solution for me. is there a way to sort by in the filter and make it a bookmark ?

i tried also the xml thing but i am sure it was not the good place…

 <field name="order"
                eval="[('id', 'DESC')]"
                pyson="1"/> 

i search in party.xml but i didn’t find where to write it.

ps It is sad (well i didn’t find) that all “filters” are on values and not in order, for exemple without showing a date col (for example to fetch last modification). But i understand that the easiness to write modules or alter views have some caveats.

tryton is my 10-20 years’ accounting solution. i was on open_erp before and tiny_erp before-before.

ps : i am on a 6.X version (/o) because that was the one that felt on working in debian 12.x

i found by try-errors

       <record model="ir.action.act_window" id="act_party_form">
            <field name="name">Parties</field>
            <field name="order" eval="[('id', 'DESC')]" pyson="1"/>
            <field name="res_model">party.party</field>
        </record>

why is that not working with “write_date”

<field name="order" eval="[('write_date', 'DESC')]" pyson="1"/>

 id  |       name       |         write_date         |
1682 | B======= ==      | 2024-11-22 15:57:34.540057 |
1681 | M============    | 2024-11-22 15:57:34.537347 |
1680 | M======== ====== | 2024-11-22 22:47:09.757349 |

the order in the tree is 

1682 | B========== ==   
1681 | M=============   
1680 | M======== ====== 

but write_date  M======== ====== is more recent

even if i

trytond-admin -c /etc/tryton/trytond.conf  -d tryton --all
systemctl restart tryton-server

i logged out and logged in
it keeps the last order by id desc

is there some kind of cache or someting like that ?

i found it it was an order clause in party.py

ok i do not understand and i do not know where (and how) to investigate.

i have the same configuration on 2 different servers. in one the changes are working, in the second one, with the same (?) configuration and the same change, it does not work.

i have the 2 files side by side to verify that there is not a typo somewhere. the order by works perfectly in psql but it fails in party view…

how can i debug that ?

I copied the entire folder from one server to the other, made an update and still the same

Ok i found the ghost : one is running
/lib/systemd/system/tryton-server.service (the one working)
and the other runs
wsgi /lib/systemd/system/tryton-server-uwsgi@.service

the mystery still here.
if i stop wsgi (with systemctl stop tryton-server-uwsgi@tryton

and systemctl start tryton-server - still not : working order bi id desc instead of write-date.

i am becoming crazy

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.