Openbravo Issue Tracking System - Localization Pack: Spain
View Issue Details
0034642Localization Pack: SpainAEAT 340public2016-11-28 09:322016-12-01 09:49
malsasua 
Sanjota 
highmajoralways
closedfixed 
20Community Appliance
 
 
aferraz
0034642: performance problem with "create register book" process
in one environment with close to 3000 invoices, the "create register book" process is very slow (more than 40 minutes)
in environment with more than 3000 invoices, run "create register book" process

the process is slow because it is computing the next line of process:
https://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/file/c4f1320e3bb9/src/org/openbravo/module/aeat340/es/api/year2012/AEAT340Report_2012APRMDao.java#l108 [^]
Replace the constructor on the ./org.openbravo.module.aeat340.es/src/org/openbravo/module/aeat340/es/bean/PaymentInfoFor340.java

with

  public PaymentInfoFor340(final String year, final String invoiceId, final BigDecimal paidAmt) {
    try {
      OBContext.setAdminMode(true);
      Invoice inv = OBDal.getInstance().get(Invoice.class, invoiceId);
      setInvoice(inv);
      setYear(year);
    OBCriteria<ReversedInvoice> obCriteria = OBDal.getInstance().createCriteria(ReversedInvoice.class);
    obCriteria.add(Restrictions.eq(ReversedInvoice.PROPERTY_INVOICE, inv));
    obCriteria.setMaxResults(1);
    List<ReversedInvoice> rInvoice = obCriteria.list();
      for (final ReversedInvoice reversedInvoice : rInvoice) {
        final Date creditMemoDate = reversedInvoice.getReversedInvoice().getInvoiceDate();
        final Calendar cal = Calendar.getInstance();
        cal.setTime(creditMemoDate);
        setYear((new Integer(cal.get(Calendar.YEAR)).toString()));
        break;
      }
    } finally {
      OBContext.restorePreviousMode();
    }
    setPaidAmt(paidAmt);
  }
Performance
related to defect 0034690 closed collazoandy4 Modules Performance problems on the invoice register book 
Issue History
2016-11-28 09:32malsasuaNew Issue
2016-11-28 09:32malsasuaAssigned To => vmromanos
2016-11-28 09:37malsasuaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13899#r13899
2016-11-28 09:37malsasuaTag Attached: Performance
2016-11-28 09:39malsasuaResolution time => 1482015600
2016-11-28 10:49egoitzProposed Solution updated
2016-11-28 10:49egoitzNote Added: 0091883
2016-11-28 10:49egoitzIssue Monitored: networkb
2016-11-28 12:17vmromanosAssigned Tovmromanos => Sanjota
2016-11-30 10:41SanjotaStatusnew => scheduled
2016-11-30 12:15hgbotCheckin
2016-11-30 12:15hgbotNote Added: 0091929
2016-11-30 12:15hgbotStatusscheduled => resolved
2016-11-30 12:15hgbotResolutionopen => fixed
2016-11-30 12:15hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/1b4f51927d46e34595ce780f26a89ead2c86beae [^]
2016-11-30 12:16hgbotCheckin
2016-11-30 12:16hgbotNote Added: 0091930
2016-11-30 12:54hgbotCheckin
2016-11-30 12:54hgbotNote Added: 0091931
2016-11-30 12:54hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/1b4f51927d46e34595ce780f26a89ead2c86beae [^] => http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/d4a1d6451a618e7e1684c9d5ba0b3d51e115d9a5 [^]
2016-11-30 12:54hgbotCheckin
2016-11-30 12:54hgbotNote Added: 0091932
2016-12-01 09:36hgbotCheckin
2016-12-01 09:36hgbotNote Added: 0091947
2016-12-01 09:44hgbotCheckin
2016-12-01 09:44hgbotNote Added: 0091948
2016-12-01 09:49aferrazReview Assigned To => aferraz
2016-12-01 09:49aferrazNote Added: 0091949
2016-12-01 09:49aferrazStatusresolved => closed
2016-12-01 09:49SanjotaNote Added: 0091950
2016-12-12 16:33aferrazRelationship addedrelated to 0034690

Notes
(0091883)
egoitz   
2016-11-28 10:49   
With the propesed solution the time has been reduced from 40 minutes to 4 minutes.
(0091929)
hgbot   
2016-11-30 12:15   
Repository: erp/pmods/org.openbravo.module.aeat340.es
Changeset: 1b4f51927d46e34595ce780f26a89ead2c86beae
Author: Sanjota <sanjota.nelagi <at> promantia.com>
Date: Tue Nov 29 17:05:59 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/1b4f51927d46e34595ce780f26a89ead2c86beae [^]

Fixes issue 34642: Performance problem with "create register book" process

Reduced the process time by changing the code to increase the performance.

---
M src/org/openbravo/module/aeat340/es/bean/PaymentInfoFor340.java
---
(0091930)
hgbot   
2016-11-30 12:16   
Repository: erp/pmods/org.openbravo.module.aeat340.es
Changeset: f7663a78ef1a7a2ad62853697f350bfffe9fcc8c
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Nov 30 11:53:18 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/f7663a78ef1a7a2ad62853697f350bfffe9fcc8c [^]

Related to issue 34642: Code review improvements

---
M src/org/openbravo/module/aeat340/es/bean/PaymentInfoFor340.java
---
(0091931)
hgbot   
2016-11-30 12:54   
Repository: erp/pmods/org.openbravo.module.aeat340.es
Changeset: d4a1d6451a618e7e1684c9d5ba0b3d51e115d9a5
Author: Sanjota <sanjota.nelagi <at> promantia.com>
Date: Tue Nov 29 17:05:59 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/d4a1d6451a618e7e1684c9d5ba0b3d51e115d9a5 [^]

Fixes issue 34642: Performance problem with "create register book" process

Reduced the process time by changing the code to increase the performance.

---
M src/org/openbravo/module/aeat340/es/bean/PaymentInfoFor340.java
---
(0091932)
hgbot   
2016-11-30 12:54   
Repository: erp/pmods/org.openbravo.module.aeat340.es
Changeset: 56b811c08b2d9aa35a3900041e34e63cf557ac86
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Nov 30 11:53:18 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/56b811c08b2d9aa35a3900041e34e63cf557ac86 [^]

Related to issue 34642: Code review improvements

---
M src/org/openbravo/module/aeat340/es/bean/PaymentInfoFor340.java
---
(0091947)
hgbot   
2016-12-01 09:36   
Repository: erp/pmods/org.openbravo.module.aeat340.es
Changeset: ebdc2fad12c61d92470149d2f0b40904b8fb6580
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Nov 30 12:25:58 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/ebdc2fad12c61d92470149d2f0b40904b8fb6580 [^]

Related to issue 34642: Update module version

---
M src-db/database/sourcedata/AD_MODULE.xml
---
(0091948)
hgbot   
2016-12-01 09:44   
Repository: erp/pmods/org.openbravo.module.aeat340.es
Changeset: 4ee6c181c2bc2a3fa027394472533993d54ba7dc
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Nov 30 12:55:05 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat340.es/rev/4ee6c181c2bc2a3fa027394472533993d54ba7dc [^]

Related to issue 34642: Update module version

---
M src-db/database/sourcedata/AD_MODULE.xml
---
(0091949)
aferraz   
2016-12-01 09:49   
Code review + Testing OK
(0091950)
Sanjota   
2016-12-01 09:49   
Test plan:
In the application install
"org.openbravo.module.aeat340.es" and it's dependent modules.
Build the application.
In Group admin role:
Import the dataset present in the module org.openbravo.module.aeat340.es
Open the Lanzar Modelo 340 window
Click on record present in the window.
Run the process "Generar Modelo 340" for that record.
Observe that the processing time is reduced comparatively.