Skip to content

Commit

Permalink
Issue #281: Improve AverageAlgorithm class
Browse files Browse the repository at this point in the history
EPL-1196: Include product.getName() in OBException
  • Loading branch information
tomirodeghiero committed Jan 22, 2024
1 parent b6dead7 commit ffd7429
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/org/openbravo/costing/AverageAlgorithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ 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@: " + transaction.getProduct().getName() + ", @Date@: "
+ ", @Product@: " + productInfo + ", @Date@: "
+ OBDateUtils.formatDate(transaction.getTransactionProcessDate()));
}
BigDecimal cost = currentCosting.getCost();
Expand Down
5 changes: 3 additions & 2 deletions src/org/openbravo/costing/CostingUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public static BigDecimal getDefaultCost(Product product, BigDecimal qty, Organiz
false);
if (stdCost == null && pp == null) {
throw new OBException(
"@NoPriceListOrStandardCostForProduct@ @Organization@: " + org.getName() + ", @Product@: "
+ product.getSearchKey() + ", @Date@: " + OBDateUtils.formatDate(costDate));
"@NoPriceListOrStandardCostForProduct@ @Organization@: " + org.getName()
+ ", @Product@: " + product.getName() + ", @ACCS_VALUE@: " + product.getSearchKey()
+ ", @Date@: " + OBDateUtils.formatDate(costDate));
} else if (stdCost != null && pp == null) {
BigDecimal standardCost = getStandardCost(product, org, costDate, costDimensions, currency);
return qty.abs().multiply(standardCost);
Expand Down

0 comments on commit ffd7429

Please sign in to comment.