Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

orm.Model browse method memory limit?

By
Carlos Llamacho
on 4/2/14, 5:13 PM 1,343 views

Hello,

I have a problem regarding a ir.cron task that runs by a bunch of assets and tries to post them automatically. Said method runs perfectly with 700 depreciation lines but when i take to production where are a considerable larger amount of assets and depreciation lines (558,747) the openerp-server just stops and falls down.

ids = self.search(cr, uid, [('state', '=', 'open')])

        for asset in self.browse(cr, uid, ids):
            for asset_line in asset.depreciation_line_ids:
                if asset_line.move_check:

This code gets all my assets that are open and then try to check for a set of conditions and post it. When it gets to the asset_line.move_check line, it takes a long time and then it kills the proccess, all while keeping the server cpu at 100%.

Any ideas on how i can improve performance on this?

1

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/3/14, 3:10 AM

Hi,

You can improve using python multiprocessing.

Thanks

Using module multiprocessing or threading? I was taking that option into consideration. Just wanted to see if someone had encountered something similar somewhere.

Carlos Llamacho
on 4/3/14, 10:47 AM

Use multiprocessing

Jagdish Panchal
on 4/3/14, 11:24 AM

Use read not browse, better performance, browse read all field from table, read take only asked field, so better performance.

ids = self.search(cr, uid, [('state', '=', 'open')])
for asset in self.read(cr, uid, ids,['depreciation_line_ids']):
            for asset_line in self.pool.get('account.asset.depreciation.line').read(cr, uid, asset['depreciation_line_ids'],['move_check']):
                if asset_line['move_check']:
Serge
on 4/7/14, 12:45 PM

Yeah, i am thinking that this is the next natural step, i already got it working with browse, but stil performance is slow and resource consumption high. I have really never used read before, i am going to have to rewrite my entire algorithm.

Carlos Llamacho
on 4/7/14, 5:46 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/2/14, 5:13 PM
Seen: 1343 times
Last updated: 3/16/15, 8:10 AM