Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0024022Openbravo ERP04. Warehouse managementpublic2013-06-07 11:322013-07-23 18:25
VictorVillar 
jecharri 
urgentmajoralways
closedfixed 
5
pi 
3.0MP26 
VictorVillar
Core
No
0024022: Wrong Transaction cost calculated for legacy transaction cost under some circunstancies
Wrong Transaction cost calculated for legacy transaction cost under some circunstancies.

Old cost engine introduced the Starting date and Ending date in the m_costing table, as DATE, without hours, minutes and seconds.

But the CostingMigrationProcess.java -- method updateLegacyCosts() --statement
 legacyCosts = getLegacyCostScroll(clientId, naturalTree);

is searching data, between the data range:

 where.append(" and trx." + MaterialTransaction.PROPERTY_MOVEMENTDATE + " >= c."
        + Costing.PROPERTY_STARTINGDATE);
    where.append(" and trx." + MaterialTransaction.PROPERTY_PRODUCT + " = c."
        + Costing.PROPERTY_PRODUCT);
    where.append(" and trx." + MaterialTransaction.PROPERTY_MOVEMENTDATE + " < c."
        + Costing.PROPERTY_ENDINGDATE);

but the problem is the movementdate parameter because is with hours, minutes and seconds. As a result of that if you have registers in the m_costing, introduced with the same date, the transaction cost will be wrong calculated, because this query does not find the correct m_costing register for the transaction movement date.
Wrong Transaction cost calculated for legacy transaction cost under some circunstancies.

Old cost engine introduced the Starting date and Ending date in the m_costing table, as DATE, without hours, minutes and seconds.

But the CostingMigrationProcess.java -- method updateLegacyCosts() --statement
 legacyCosts = getLegacyCostScroll(clientId, naturalTree);

is searching data, between the data range:

 where.append(" and trx." + MaterialTransaction.PROPERTY_MOVEMENTDATE + " >= c."
        + Costing.PROPERTY_STARTINGDATE);
    where.append(" and trx." + MaterialTransaction.PROPERTY_PRODUCT + " = c."
        + Costing.PROPERTY_PRODUCT);
    where.append(" and trx." + MaterialTransaction.PROPERTY_MOVEMENTDATE + " < c."
        + Costing.PROPERTY_ENDINGDATE);

but the problem is the movementdate parameter because is with hours, minutes and seconds. As a result of that if you have registers in the m_costing, introduced with the same date, the transaction cost will be wrong calculated, because this query does not find the correct m_costing register for the transaction movement date.
The solution could be to truncate the movement date
No tags attached.
Issue History
2013-06-07 11:32VictorVillarNew Issue
2013-06-07 11:32VictorVillarAssigned To => dmiguelez
2013-06-07 11:32VictorVillarModules => Core
2013-06-07 11:32VictorVillarResolution time => 1372629600
2013-06-07 11:32VictorVillarTriggers an Emergency Pack => No
2013-06-07 11:33VictorVillarIssue Monitored: networkb
2013-06-07 11:34VictorVillarDescription Updatedbug_revision_view_page.php?rev_id=4781#r4781
2013-06-07 11:34VictorVillarSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=4783#r4783
2013-06-07 14:45dmiguelezAssigned Todmiguelez => jonalegriaesarte
2013-06-07 16:10VictorVillarProposed Solution updated
2013-06-21 12:29jonalegriaesarteAssigned Tojonalegriaesarte => jecharri
2013-06-28 14:12jonalegriaesarteTarget Version3.0MP25 => 3.0MP26
2013-07-02 01:32hgbotCheckin
2013-07-02 01:32hgbotNote Added: 0059799
2013-07-02 01:32hgbotStatusnew => resolved
2013-07-02 01:32hgbotResolutionopen => fixed
2013-07-02 01:32hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/5444242cd48cb455535e4f7b9f63fc1b72f951b1 [^]
2013-07-16 14:26hudsonbotCheckin
2013-07-16 14:26hudsonbotNote Added: 0060007
2013-07-23 18:25VictorVillarReview Assigned To => VictorVillar
2013-07-23 18:25VictorVillarNote Added: 0060200
2013-07-23 18:25VictorVillarStatusresolved => closed

Notes
(0059799)
hgbot   
2013-07-02 01:32   
Repository: erp/devel/pi
Changeset: 5444242cd48cb455535e4f7b9f63fc1b72f951b1
Author: Javier Etxarri <javier.echarri <at> openbravo.com>
Date: Tue Jul 02 01:32:45 2013 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5444242cd48cb455535e4f7b9f63fc1b72f951b1 [^]

Fixes issue 24022: Wrong Transaction cost
calculated for legacy transaction cost under some circunstancies

---
M src/org/openbravo/costing/CostingMigrationProcess.java
---
(0060007)
hudsonbot   
2013-07-16 14:26   
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/9a5d5983399f [^]

Maturity status: Test
(0060200)
VictorVillar   
2013-07-23 18:25   
Verified