Skip to content

Commit

Permalink
Issue #281: Refactor OBException message construction
Browse files Browse the repository at this point in the history
EPL-1196: Directly embed product name and search key in OBException message to align with CostingUtils.java formatting
  • Loading branch information
tomirodeghiero committed Jan 23, 2024
1 parent 734493e commit f80786d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/org/openbravo/costing/AverageAlgorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,9 @@ public BigDecimal getTransactionCost() {
protected BigDecimal getOutgoingTransactionCost() {
final Costing currentCosting = getProductCost();
if (currentCosting == null) {
Product product = transaction.getProduct();
String productInfo = String.format("%s (Search Key: %s)", product.getName(), product.getSearchKey());

throw new OBException("@NoAvgCostDefined@ @Organization@: " + costOrg.getName()
+ ", @Product@: " + productInfo + ", @Date@: "
+ OBDateUtils.formatDate(transaction.getTransactionProcessDate()));
+ ", @Product@: " + transaction.getProduct().getName() + ", @ACCS_VALUE@: " + transaction.getProduct().getSearchKey()
+ ", @Date@: " + OBDateUtils.formatDate(transaction.getTransactionProcessDate()));
}
BigDecimal cost = currentCosting.getCost();
if (currentCosting.getCurrency() != costCurrency) {
Expand Down

0 comments on commit f80786d

Please sign in to comment.