Author: lektran
Date: Sun Jun 12 21:44:03 2011
New Revision: 1134990
URL:
http://svn.apache.org/viewvc?rev=1134990&view=revLog:
[OFBIZ-4297] Changed set operation to explicitly return a BigDecimal also changed the updateProductAverageCostOnReceiveInventory service definition so that quantityAccepted is a BigDecimal instead of String. For some reason EL expressions return a String even when performing an operation on numbers. Thanks to Stéphane Ducas for the bug report and suggested fix.
Modified:
ofbiz/trunk/applications/accounting/servicedef/services_cost.xml
ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml
Modified: ofbiz/trunk/applications/accounting/servicedef/services_cost.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_cost.xml?rev=1134990&r1=1134989&r2=1134990&view=diff==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_cost.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_cost.xml Sun Jun 12 21:44:03 2011
@@ -91,7 +91,7 @@ under the License.
<description>Update a Product Average Cost record on receive inventory</description>
<permission-service service-name="acctgCostPermissionCheck" main-action="UPDATE"/>
<attribute name="facilityId" type="String" mode="IN" optional="false"/>
- <attribute name="quantityAccepted" type="String" mode="IN" optional="false"/>
+ <attribute name="quantityAccepted" type="BigDecimal" mode="IN" optional="false"/>
<attribute name="productId" type="String" mode="IN" optional="false"/>
<attribute name="inventoryItemId" type="String" mode="IN" optional="false"/>
</service>
Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml?rev=1134990&r1=1134989&r2=1134990&view=diff==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml Sun Jun 12 21:44:03 2011
@@ -572,7 +572,7 @@ under the License.
<result-to-field result-name="quantityOnHandTotal"/>
</call-service>
- <set field="oldProductQuantity" value="${quantityOnHandTotal - parameters.quantityAccepted}"/>
+ <set field="oldProductQuantity" value="${quantityOnHandTotal - parameters.quantityAccepted}" type="BigDecimal"/>
<set field="productAverageCostMap.averageCost" value="${((productAverageCost.averageCost * oldProductQuantity) + (inventoryItem.unitCost * parameters.quantityAccepted))/(quantityOnHandTotal)}" type="BigDecimal"/>
<property-to-field resource="arithmetic" property="finaccount.decimals" field="roundingDecimals" default="2"/>
<property-to-field resource="arithmetic" property="finaccount.roundingSimpleMethod" field="roundingMode" default="HalfUp"/>