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'])