Related to bug
28289:Do @FixBackdateFromBeforeStartingDate@ later in the process.
Check the validation at the end of the Costing Rule Validation process when fixbackdated from and starting date are being initialized.
Also update the error message displayed.
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Wed Dec 17 21:45:17 2014 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Fri Dec 19 13:15:14 2014 +0100
@@ -24876,7 +24876,7 @@
<!--DD89935E99164E87897CEE1CC67F5BB0--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
<!--DD89935E99164E87897CEE1CC67F5BB0--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--DD89935E99164E87897CEE1CC67F5BB0--> <VALUE><![CDATA[FixBackdateFromBeforeStartingDate]]></VALUE>
-<!--DD89935E99164E87897CEE1CC67F5BB0--> <MSGTEXT><![CDATA[Fix Backdated From Date is before Starting Date, and this is wrong. It should be equal or later.]]></MSGTEXT>
+<!--DD89935E99164E87897CEE1CC67F5BB0--> <MSGTEXT><![CDATA[Fix Backdated From should be equal or later than the Starting Date of the Costing Rule]]></MSGTEXT>
<!--DD89935E99164E87897CEE1CC67F5BB0--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
<!--DD89935E99164E87897CEE1CC67F5BB0--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
<!--DD89935E99164E87897CEE1CC67F5BB0--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
--- a/src/org/openbravo/costing/CostingRuleProcess.java Wed Dec 17 21:45:17 2014 +0100
+++ b/src/org/openbravo/costing/CostingRuleProcess.java Fri Dec 19 13:15:14 2014 +0100
@@ -77,11 +77,6 @@
OBContext.setAdminMode(false);
final String ruleId = (String) bundle.getParams().get("M_Costing_Rule_ID");
CostingRule rule = OBDal.getInstance().get(CostingRule.class, ruleId);
- if (rule.getStartingDate() != null && rule.getFixbackdatedfrom() != null
- && rule.isBackdatedTransactionsFixed()
- && rule.getFixbackdatedfrom().before(rule.getStartingDate())) {
- throw new OBException("@FixBackdateFromBeforeStartingDate@");
- }
if (rule.getOrganization().getCurrency() == null) {
throw new OBException("@NoCurrencyInCostingRuleOrg@");
}
@@ -133,6 +128,12 @@
updateInventoriesCostAndProcessInitInventories(ruleId, startingDate, existsPreviousRule);
}
+ if (rule.getStartingDate() != null && rule.getFixbackdatedfrom() != null
+ && rule.isBackdatedTransactionsFixed()
+ && rule.getFixbackdatedfrom().before(rule.getStartingDate())) {
+ throw new OBException("@FixBackdateFromBeforeStartingDate@");
+ }
+
// Reload rule after possible session clear.
rule = OBDal.getInstance().get(CostingRule.class, ruleId);
rule.setValidated(true);