Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
4004 Tampilan

In ./account_asset/account_asset.py

OdooV7 declares a new one2many field "entry_ids" that is part of the same model where is declared for

the field "entry_ids" in account_move_line that points to one or more other account_move_lines

class account_move_line(osv.osv):       
_inherit = 'account.move.line'
_columns = {
'asset_id': fields.many2one('account.asset.asset', 'Asset', ondelete="restrict"),
'entry_ids': fields.one2many('account.move.line', asset_id', 'Entries',
readonly=True, states={'draft':[('readonly',False)]}),
}

If you now do a copy of this account_move_line or even a read of the field "entry_ids", It wil generate a query that kills your performance.

with following query:


SELECT "account_move_line".id FROM "account_move_line" LEFT JOIN "account_invoice_line" as "account_move_line__invoice_line_id" ON ("account_move_line"."invoice_line_id" = "account_move_line__invoice_line_id"."id") WHERE ("account_move_line"."asset_id" in (2689720)) ORDER BY "account_move_line__invoice_line_id"."id"

FULL TABLE SCAN on the big table account_move_line!

Is this a bug? And is it reported and fixed somewhere??

I simulated it via xml-rpc and this gives the same problem

import oerplib
oerp = oerplib.OERP(server='0.0.0.0', database='natuurpunt', protocol='xmlrpc', port=5000)
user = oerp.login(user='xxx', passwd='xxx')
oerp.execute('account_move_line', 'read', [2689720], ['entry_ids'])
Avatar
Buang
Penulis Jawaban Terbai

I see the fields is removed in V8

https://github.com/odoo/odoo/blob/8.0/addons/account_asset/account_asset.py


I guess this can also be removed in V7. But offcourse no offical support anymore. Is there nobody doing backports of fixed issue of V8 to V7?

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Des 23
42094
1
Mar 15
6112
1
Jul 20
6839
0
Jul 25
883
1
Jul 25
703