details: https://code.openbravo.com/erp/devel/pi/rev/cba032bafcb0
changeset: 25774:cba032bafcb0
user: Unai Martirena <unai.martirena <at> openbravo.com>
date: Thu Jan 29 19:04:28 2015 +0100
summary: Fixes bug 28814: NPE fixed in Costing Background for a production
product
When a product is defined as production the costing records created in the
system are always for * organization. If a transaction of this product it was
creating a backdated cost adjustment, in one place of the code a NPE exception
error was happening because a costing record of legal entity org it was being
trying to get. This has been fixed always filtering by client instead of
organization when the product is of production type.
diffstat:
src/org/openbravo/costing/AverageCostAdjustment.java | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diffs (40 lines):
diff -r 66b7801263ab -r cba032bafcb0
src/org/openbravo/costing/AverageCostAdjustment.java
--- a/src/org/openbravo/costing/AverageCostAdjustment.java Thu Jan 22
23:38:18 2015 +0530
+++ b/src/org/openbravo/costing/AverageCostAdjustment.java Thu Jan 29
19:04:28 2015 +0100
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015 Openbravo SLU
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
*************************************************************************
@@ -723,7 +723,12 @@
where.append(" as c");
where.append(" left join c." + Costing.PROPERTY_INVENTORYTRANSACTION + "
as trx");
where.append(" where c." + Costing.PROPERTY_PRODUCT + " = :product");
- where.append(" and c." + Costing.PROPERTY_ORGANIZATION + " = :org");
+ // FIXME: remove when manufacturing costs are fully migrated
+ if (bdCosting.getProduct().isProduction()) {
+ where.append(" and c." + Costing.PROPERTY_CLIENT + " = :client");
+ } else {
+ where.append(" and c." + Costing.PROPERTY_ORGANIZATION + " = :org");
+ }
where.append(" and c." + Costing.PROPERTY_COSTTYPE + " = 'AVA'");
if (bdCosting.getWarehouse() == null) {
where.append(" and c." + Costing.PROPERTY_WAREHOUSE + " is null");
@@ -738,7 +743,12 @@
OBQuery<Costing> qryCosting =
OBDal.getInstance().createQuery(Costing.class, where.toString());
qryCosting.setNamedParameter("product", bdCosting.getProduct());
- qryCosting.setNamedParameter("org", bdCosting.getOrganization());
+ // FIXME: remove when manufacturing costs are fully migrated
+ if (bdCosting.getProduct().isProduction()) {
+ qryCosting.setNamedParameter("client", bdCosting.getClient());
+ } else {
+ qryCosting.setNamedParameter("org", bdCosting.getOrganization());
+ }
if (bdCosting.getWarehouse() != null) {
qryCosting.setNamedParameter("warehouse", bdCosting.getWarehouse());
}
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits