← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 740353] Re: [6.0.1][account] dog slow invoice cancel because validate for every line; patch included

 

** Patch added: "account.patch"
   https://bugs.launchpad.net/bugs/740353/+attachment/1930626/+files/account.patch

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/740353

Title:
  [6.0.1][account] dog slow invoice cancel because validate for every
  line; patch included

Status in OpenERP Modules (addons):
  New

Bug description:
  Try to create a large invoice with like 100 lines and validate it
  (it's slow but that's for an other one).

  Now let's cancel it.
  It's kind of slow like hell right?

  In production with customer, it takes like 15 minutes to cancel... Not
  very user friendly...

  Now let's analyse why.
  Let's put some print statement in the account_move#validate method.

  You'll see that instead of passing here once per invoice, we are
  passing here once per invoice line, after we remove every single move
  line. This is stupid, we can do it only once after removing the lines.

  This issue is that the generic unlink method from account_move_lines is not smart enough to take in consideration the case where all move lines belong to the same account move. But this is very common, especially in our common cancel invoice use case!
  Given how slow the account_move#validate slow it, we should always try to factor the move ids together before calling this validate method, otherwise we just do the same slow thing over and over like 100 times in our test case.

  The included patch just do that. Thank you to apply it, OpenERP users will thank you a lot.
  Before our patch: 50 lines invoices would take 15 minutes to cancel; it now takes only 10 seconds. Call it an improvement ;-)



Follow ups

References