Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0035203
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 09. Financial managementmajorsometimes2017-02-08 16:062017-03-15 20:19
ReportermalsasuaView Statuspublic 
Assigned Tovmromanos 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revision37941a0223cf
ProjectionnoneETAnoneTarget Version
OSLinux 32 bitDatabasePostgreSQLJava version1.6.0_18
OS VersionCommunity ApplianceDatabase version8.3.9Ant version1.7.1
Product VersionSCM revision 
Review Assigned Tovmromanos
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0035203: performance problem in DocInvoice with cashvat functionality

DescriptionIf you have using Cash Vat functionality in invoices, and it is a instance with a high volumes (>5 millions invoice lines), when you try to post one invoice, it takes more than 30 seconds
Steps To Reproducewith high volume, create and process one invoice with the "cash vat" option selected
. run post process
it takes more than 30 seconds
Proposed SolutionThe problem is in this function
https://code.openbravo.com/erp/devel/pi/file/37570fc76755/src/org/openbravo/erpCommon/utility/CashVATUtil.java#l393 [^]

it is very slow because it is doing a join between c_invoicetax_cashvat_v view and c_invoicetax and c_invoice tables.

The joins could be removed from query if two new columns are added in the view c_invoicetax_cashvat_v: c_invoice_id and c_tax_id (see attachments). This info is available in the tables used in the view, but they are not returned in the select section
TagsPerformance
Attached Filesdiff file icon diffCashVatPerformance.diff [^] (12,856 bytes) 2017-02-08 17:25 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0094319)
vmromanos (manager)
2017-02-14 14:34

Install Cash VAT module

Log in as Openbravo, client FB
Go to Tax Rate window, create a new record:
 * Name = Cash VAT
 * Rate = 21%
 * Valid from = Today
 * Country = Spain
 * Cash Vat = Y
Go to accounting tab and enter any account in temporary Cash VAT accounts for each of the general ledgers.

Test I:
Go to Sales Invoice and create a new record for Spain org. Set Cash VAT = Y
Enter any line and select Cash VAT tax rate
Complete it
Post it.
Verify tax amounts have been assigned to temporary cash vat accounts since no prepayment has been made.

Test II:
Go to Sales order and create a new record for Spain org. Set Cash VAT = Y. Invoice terms = immediate.
Enter any line and select Cash VAT tax rate
Complete it.
Add a payment that fully pays the order.
Go to Sales Invoice window and create a new invoice using the Create Lines from button and selecting the previously fully paid order.
Complete it.
Post it.
Verify tax amounts have been assigned to the final tax accounts (not the temporary cash vat ones)


Test III:
Go to Sales order and create a new record for Spain org. Set Cash VAT = Y. Invoice terms = immediate.
Enter any line and select Cash VAT tax rate
Complete it.
Add a payment that partially pays the order.
Go to Sales Invoice window and create a new invoice using the Create Lines from button and selecting the previously partially paid order.
Complete it.
Post it.
Verify part of the tax amounts have been assigned to the final tax accounts (which corresponds to the amount already prepaid), and the rest of the tax amounts have been assigned to the temporary tax accounts (percentage not paid yet).
(0094346)
hgbot (developer)
2017-02-15 09:22

Repository: erp/devel/pi
Changeset: 37941a0223cf729a6859a3d2c71058195da909b6
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Tue Feb 14 14:44:17 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/37941a0223cf729a6859a3d2c71058195da909b6 [^]

Fixed bug 35203: performance problem in DocInvoice with cashvat functionality

Solution based on patch supplied by MAL.

Added three new columns to C_INVOICETAX_CASHVAT_V view: c_invoice_id, c_tax_id and isprepayment. Note that this won't create a performance issue, since the correspondent tables are already included in the view.
Redesign HQL query in CashVATUtil.calculatePrepaidPercentageForCashVATTax() method to use those new columns avoiding slow joins to external tables.

After the change the query for this method just uses the C_InvoiceTax_CashVAT_V view without joining with other tables thus improving the performance.

---
M src-db/database/model/views/C_INVOICETAX_CASHVAT_V.xml
M src-db/database/sourcedata/AD_COLUMN.xml
M src/org/openbravo/erpCommon/utility/CashVATUtil.java
---
(0094348)
vmromanos (manager)
2017-02-15 09:36

Code review + testing OK.

Note the code is highly based on the one provided by MAL, that's why the resolver and the reviewer are the same person in this issue.
(0095184)
hudsonbot (developer)
2017-03-15 20:19

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/54e102bef53e [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2017-02-08 16:06 malsasua New Issue
2017-02-08 16:06 malsasua Assigned To => Triage Finance
2017-02-08 16:06 malsasua Modules => Core
2017-02-08 16:06 malsasua Resolution time => 1488063600
2017-02-08 16:06 malsasua Triggers an Emergency Pack => No
2017-02-08 17:10 markmm82 Assigned To Triage Finance => Sanjota
2017-02-08 17:25 malsasua File Added: diffCashVatPerformance.diff
2017-02-08 17:38 malsasua Tag Attached: Performance
2017-02-14 09:53 vmromanos Assigned To Sanjota => vmromanos
2017-02-14 12:56 vmromanos Status new => scheduled
2017-02-14 14:34 vmromanos Note Added: 0094319
2017-02-15 09:22 hgbot Checkin
2017-02-15 09:22 hgbot Note Added: 0094346
2017-02-15 09:22 hgbot Status scheduled => resolved
2017-02-15 09:22 hgbot Resolution open => fixed
2017-02-15 09:22 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/37941a0223cf729a6859a3d2c71058195da909b6 [^]
2017-02-15 09:36 vmromanos Review Assigned To => vmromanos
2017-02-15 09:36 vmromanos Note Added: 0094348
2017-02-15 09:36 vmromanos Status resolved => closed
2017-03-15 20:19 hudsonbot Checkin
2017-03-15 20:19 hudsonbot Note Added: 0095184


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker