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

Hello there,

In the chart of accounts and in the accounts list, we want to sort accounts by CODE.

For example, In the parent account 3, we would want to sort accounts like 3.1, 3.2, 3.3, etc.

Actually, the account_account class is defined like this in Odoo 8 :

class account_account(osv.osv):
    _order = "parent_left"
_parent_order = "code"
_name = "account.account"
_description = "Account"
_parent_store = True


How to override this class account_account to sort by CODE in each parent?

Thanks to help


In image (what we actually have) :


Avatar
Verwerfen
Autor Beste Antwort

I have tried many combinationsfor _order and _parent_order of account_account class. Always get the same error. 

For example, If I tried to change _order directly in the original account.py file like this :

class account_account(osv.osv):
     _order = "code asc" ###instead of _order = "parent_left"
     _parent_order = "code"
     _name = "account.account"
     _description = "Account"
     _parent_store = True

For all combinations I have tried, I got this error :

  File "/home/odoo-iv/odoo-8.0-20170119/openerp/addons/account/account.py", line 364, in __compute
    sums[current.id][fn] += sums[child.id][fn]
KeyError: 144

So, I have decided to change 'parent_left' and 'parent_right' field values for accounts in account.account database's table. I did it manually directly in the database.

Now I have this :

 


Thanks for your answers

Avatar
Verwerfen
Beste Antwort

dear Pascal

 

Try to make order like this 

_order = 'field1 asc, field2 asc'

Field1: the first to field

Field2: the second to field

I hope I helped you...
Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
März 15
3294
0
Dez. 16
3175
2
Feb. 19
6379
2
Juni 17
6579
3
Dez. 15
5155