Products more than 10000 slow down the printing of Location Content report

Bug #776493 reported by Sinoj Sebastin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP's Framework R&D

Bug Description

Hello,
Printing of "Location Content" report from the right pane of "Stock by Location" taking a long time to produce the report, and sometimes it will not produce the pdf at all when the number of product is in range of 10000. I think it is running the function "process" on "addons/stock/report/lot_overview_all.py". This function is calling the "_product_get_all_report function on "addons/stock/stock.py" which is calling "_product_get_report" function on same file. In _product_get_report function, it is looping all the 10000+ products which slow down the printing of report. Please check and improve the performance of this function.

Thank you.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Carlo - Didotech.com (iw3hxn) wrote :

Hi, is possible to fix in this mode:

on file stock/report/stock_overview.py

on def process(self, location_id) function you have to search only product that have move on this location

so on line 38

        location_obj = pooler.get_pool(self.cr.dbname).get('stock.location')
        # search product_ids
        stock_move_obj = pooler.get_pool(self.cr.dbname).get('stock.move')
        move_ids = stock_move_obj.search(self.cr, self.uid, ['|', ('location_id', 'child_of', location_id), ('location_dest_id', 'child_of', location_id)])
        product_ids = []
        for move in stock_move_obj.browse(self.cr, self.uid, move_ids, self.context):
            if move.product_id.id not in product_ids:
                product_ids.append(move.product_id.id)

        data = location_obj._product_get_report(self.cr, self.uid, [location_id], product_ids, self.context, recursive=False)

Revision history for this message
Carlo - Didotech.com (iw3hxn) wrote :

This is the patch

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Hello Carlo,

The dev of openerp / odoo has moved to github. You should make a pull request on github with the patch you propose: this will ensure a higher visibility. Don't forget to point to this issue in your description.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.