Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034189Openbravo ERP04. Warehouse managementpublic2016-07-01 14:252016-11-04 15:08
VictorVillar 
dmiguelez 
immediatecriticalalways
closedfixed 
5
 
3.0PR16Q43.0PR16Q4 
aferraz
Core
No
0034189: Bad performance Costing Background process using 3 types of adjustments
Bad performance Costing Background process using 3 types of adjustments
Bad performance Costing Background process using 3 types of adjustments: Backdated, Price Cost Correction, Negative Stock correction.

This query is taking more than 1.5 seconds:

2016-07-01 04:21:54 CDT LOG: duration: 1699.337 ms execute S_18203/C_18204: select max(materialmg0_.MovementDate) as col_0_0_ from M_Transaction materialmg0_ where materialmg0_.IsCostCalculated='Y' and (materialmg0_.AD_Org_ID in ($1))
No tags attached.
blocks defect 00334113.0PR17Q1 closed dmiguelez Bad performance Costing Background process using 3 types of adjustments 
Issue History
2016-10-11 18:24aferrazTypedefect => backport
2016-10-11 18:24aferrazTarget Version3.0PR17Q1 => 3.0PR16Q4
2016-11-03 21:04hgbotCheckin
2016-11-03 21:04hgbotNote Added: 0091141
2016-11-03 21:04hgbotStatusscheduled => resolved
2016-11-03 21:04hgbotResolutionopen => fixed
2016-11-03 21:04hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/bbc17f33517b305885622b7b8db4880ee6934967 [^]
2016-11-03 21:04hgbotCheckin
2016-11-03 21:04hgbotNote Added: 0091142
2016-11-03 21:04hgbotCheckin
2016-11-03 21:04hgbotNote Added: 0091143
2016-11-03 21:04hgbotCheckin
2016-11-03 21:04hgbotNote Added: 0091144
2016-11-03 21:04hgbotCheckin
2016-11-03 21:04hgbotNote Added: 0091145
2016-11-03 21:04hgbotCheckin
2016-11-03 21:04hgbotNote Added: 0091146
2016-11-03 21:10aferrazReview Assigned To => aferraz
2016-11-03 21:10aferrazNote Added: 0091154
2016-11-03 21:10aferrazStatusresolved => closed
2016-11-03 21:10aferrazFixed in Version => 3.0PR16Q4
2016-11-04 15:06hgbotCheckin
2016-11-04 15:06hgbotNote Added: 0091175
2016-11-04 15:08aferrazNote Deleted: 0091154
2016-11-04 15:08aferrazNote Added: 0091178

Notes
(0091141)
hgbot   
2016-11-03 21:04   
Repository: erp/backports/3.0PR16Q4
Changeset: bbc17f33517b305885622b7b8db4880ee6934967
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Mon Sep 26 19:57:27 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/bbc17f33517b305885622b7b8db4880ee6934967 [^]

Fixes issue 34189: Bad performance in Costing Background with all adjustments

- Add M_TRANSACTION_TRXPROCDATE index same as M_TRANSACTION_MOVEMENTDATE
- Modify M_TRANSACTION_CALCULATED index, by adding movementdate column in order to improve CostingUtils.getMaxTransactionDate query.
- Add new M_LASTTRX table to store last transaction movementdate and improve CostAdjustmentUtils.isNeededBackdatedCostAdjustment query.

---
M src-db/database/model/tables/M_TRANSACTION.xml
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_TABLE.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
A src-db/database/model/tables/M_LASTTRX.xml
---
(0091142)
hgbot   
2016-11-03 21:04   
Repository: erp/backports/3.0PR16Q4
Changeset: 54b2c8a6fb7de0beb9568c2845c4ed03e8a59853
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Sep 27 12:38:06 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/54b2c8a6fb7de0beb9568c2845c4ed03e8a59853 [^]

Related to issue 34189: Code review improvements

- Remove unnecessary M_LASTTRX_PRODUCT_IDX and M_LASTTRX_WAREHOUSE_IDX indexes and create M_LASTTRX_PRODUCT_ORG_WH index with m_product_id, ad_org_id and m_warehouse_id columns.
- Remove unnecessary M_TRX_CALCULATED_MOVEMENTDATE and M_TRX_CALCULATED_PRODUCT_DATES indexes.
- Remove unneeded parameters in CostingServer.updateLastTransaction method, and make it private and non static.
- Remove unnecessary flush() after calling to updateLastTransaction, as flush() is already done in finally statement.
- Move getLastTransaction method from CostingServer to CostAdjustmentUtils class.
- Remove unneeded startingDate parameter in CostAdjustmentUtils.getLastTransaction method.
- Merge isBeforeLastTransaction and isAfterLastTransaction methods into CostAdjustmentUtils.compareToLastTransaction new method.

---
M src-db/database/model/tables/M_LASTTRX.xml
M src-db/database/model/tables/M_TRANSACTION.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
---
(0091143)
hgbot   
2016-11-03 21:04   
Repository: erp/backports/3.0PR16Q4
Changeset: b88e19da46e56352ddaed61d829b2b18c76185f4
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Sep 27 19:29:56 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/b88e19da46e56352ddaed61d829b2b18c76185f4 [^]

Related to issue 34189: Rename table from M_LASTTRX to M_TRANSACTION_LAST

Rename table from M_LASTTRX to M_TRANSACTION_LAST and remove unneeded movementdate, trxprocessdate, movementtype and qty columns.

---
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_TABLE.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
A src-db/database/model/tables/M_TRANSACTION_LAST.xml
R src-db/database/model/tables/M_LASTTRX.xml
---
(0091144)
hgbot   
2016-11-03 21:04   
Repository: erp/backports/3.0PR16Q4
Changeset: 76260019ecff107eabbaf2fd8fae3aa2959cabe8
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Oct 11 18:50:35 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/76260019ecff107eabbaf2fd8fae3aa2959cabe8 [^]

Related to issue 34189: Run Synchronize Terminology

---
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_ELEMENT.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
---
(0091145)
hgbot   
2016-11-03 21:04   
Repository: erp/backports/3.0PR16Q4
Changeset: fea7f984c0d3cb474bbff1146b066d9a45b4cc59
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Sep 27 19:34:57 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/fea7f984c0d3cb474bbff1146b066d9a45b4cc59 [^]

Related to issue 34189: Delete TransactionLast when validating new Costing Rule

Delete M_Transaction_Last when validating a new Costing Rule and exists a previous rule.

---
M src/org/openbravo/costing/CostingRuleProcess.java
---
(0091146)
hgbot   
2016-11-03 21:04   
Repository: erp/backports/3.0PR16Q4
Changeset: 8fa93e685008c71034ceabcc2c1ecf5000c3fb6c
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Nov 03 13:57:43 2016 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/8fa93e685008c71034ceabcc2c1ecf5000c3fb6c [^]

Related to issue 34189: Initialize TransactionLast table

In case TransactionLast has not been initialized yet, it will be done by CostAdjustmentUtils.insertLastTransaction method when calling CostAdjustmentUtils.isNeededBackdatedCostAdjustment.

---
M src/org/openbravo/costing/CostAdjustmentUtils.java
---
(0091175)
hgbot   
2016-11-04 15:06   
Repository: erp/backports/3.0PR16Q4
Changeset: 24a5506e9ba089a763b8b1e6cdebd1dbb479036b
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Fri Nov 04 14:33:35 2016 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR16Q4/rev/24a5506e9ba089a763b8b1e6cdebd1dbb479036b [^]

Related to issue 34189: Update last transaction before check cost adjustments

---
M src/org/openbravo/costing/CostingServer.java
---
(0091178)
aferraz   
2016-11-04 15:08   
Code review + Testing OK