Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0031207Openbravo ERP04. Warehouse managementpublic2015-10-21 16:432015-11-23 21:17
VictorVillar 
aferraz 
immediatemajoralways
closedfixed 
5
pi 
3.0PR16Q1 
dmiguelez
Core
No
0031207: The costing background process fails when the 'fixbackdated from' is defined before the costing rule's starting date
The costing background process fails when the 'fixbackdated from' is defined before the costing rule's starting date and it should not.
The costing background process fails when the 'fixbackdated from' is defined before the costing rule's starting date and it should not because it does not make sense to adjust something either that was calculated by the old costing engine or by other costing algorithm.

Because of that we have identified 3 problems:

1.- UI: possibility to select the 'Fix backdated From' date before the starting date of the costing rule and if the starting date is blank it should not be possible to select one before it started the costing rule

2.- necessary to fix the following method: getCostingRuleFixBackdatedFrom in CostingUtils.java because is the same as getCostingRuleStartingDate.
if (rule.getStartingDate() == null) {
      SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM-yyyy");
      try {
        return outputFormat.parse("01-01-1900");
      } catch (ParseException e) {
        // Error parsing the date.
        log4j.error("Error parsing the date.", e);
        return null;
      }
    }
    return rule.getStartingDate();
  }

3.- Necessary to control in our code the FixBackdatedFrom date in order to adjust the backdated. Proposed solution (CostingServer.java - method:checkCostAdjustments)

    if (getCostingRule().isBackdatedTransactionsFixed()
        && transaction.getMovementDate().after(
            CostingUtils.getCostingRuleStartingDate(getCostingRule()))
            && transaction.getMovementDate().after(
            CostingUtils.getCostingRuleFixBackdatedFrom(getCostingRule()))
        && CostAdjustmentUtils.isNeededBackdatedCostAdjustment(transaction, getCostingRule()
            .isWarehouseDimension(), CostingUtils.getCostingRuleStartingDate(getCostingRule()))) {
      // BDT= Backdated transaction
      CostAdjustment costAdjustmentHeader = CostAdjustmentUtils.insertCostAdjustmentHeader(
          transaction.getOrganization(), "BDT");
No tags attached.
related to design defect 0030100 scheduled dmiguelez Costing Process fails when tries to calculate backdated Transactions with a Movement Date Prior to the 1 set in the Costing Rule 
Issue History
2015-10-21 16:43VictorVillarNew Issue
2015-10-21 16:43VictorVillarAssigned To => Triage Finance
2015-10-21 16:43VictorVillarModules => Core
2015-10-21 16:43VictorVillarResolution time => 1447110000
2015-10-21 16:43VictorVillarTriggers an Emergency Pack => No
2015-10-21 16:53heccamIssue Monitored: heccam
2015-11-04 17:19aferrazAssigned ToTriage Finance => aferraz
2015-11-04 17:19aferrazStatusnew => scheduled
2015-11-16 17:11hgbotCheckin
2015-11-16 17:11hgbotNote Added: 0081894
2015-11-16 17:11hgbotStatusscheduled => resolved
2015-11-16 17:11hgbotResolutionopen => fixed
2015-11-16 17:11hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/ba4bca8ad1962501fc3946fa699d2b5965ac27d3 [^]
2015-11-16 17:11dmiguelezReview Assigned To => dmiguelez
2015-11-16 17:11dmiguelezNote Added: 0081896
2015-11-16 17:11dmiguelezStatusresolved => closed
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082240
2016-03-21 13:33VictorVillarRelationship addedrelated to 0030100

Notes
(0081894)
hgbot   
2015-11-16 17:11   
Repository: erp/devel/pi
Changeset: ba4bca8ad1962501fc3946fa699d2b5965ac27d3
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Fri Nov 06 13:14:15 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/ba4bca8ad1962501fc3946fa699d2b5965ac27d3 [^]

Fixes issue 31207: Error when the FixBackdatedFrom is before StartingDate

The costing background process was failing when the 'fixbackdated from' is defined before the costing rule's starting date.
Check transaction movement date is equals or after than costing rule fix backdated from date, when creating BDT cost adjustments.
getCostingRuleFixBackdatedFrom method in CostingUtils was wrongly retrieving costing rule starting date instead of fix backdated from date.

---
M src/org/openbravo/costing/CostingServer.java
M src/org/openbravo/costing/CostingUtils.java
---
(0081896)
dmiguelez   
2015-11-16 17:11   
Code Review + Testing Ok
(0082240)
hudsonbot   
2015-11-23 21:17   
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/7b56bebaaa88 [^]
Maturity status: Test