account_move.unlink serious performance issue when has lot of lines

Bug #1034554 reported by Pedro Manuel Baeza
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP R&D Addons Team 3

Bug Description

If you are deleting an account move with a lot of account move lines, both with code or with client interface, processing time rises exponentially.

Browsing the code, I can see two reasons for this:

- '_update_check' method of 'account_move_line' is called twice. Once in 'unlink' method of 'account_move' and other in 'unlink' method of 'account_move_line'. However this doesn't produce the bottleneck.
- In 'unlink' method of 'account_move', before calling super, 'unlink' method of 'account_move_line' is called, but one optional parameter called 'check' is not present, causing that after every line deleted method 'validate' is called, which slow down a lot the operation.

SOLUTION: I think that calling 'unlink' method of 'account_move_line' with parameter 'check=False' is safe, because you are removing entire account move, and avoid this bottleneck. Also, the '_update_check' call in 'account_move.unlink' can be removed safely.

description: updated
Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Wishlist
status: New → Confirmed
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.