[ofbiz-plugins] branch release17.12 updated: Fixed: service 'loadSalesOrderItemFact' has hard coded currencyUomId (OFBIZ-11033)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-plugins] branch release17.12 updated: Fixed: service 'loadSalesOrderItemFact' has hard coded currencyUomId (OFBIZ-11033)

Pawan Verma-2
This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new 7996d14  Fixed: service 'loadSalesOrderItemFact' has hard coded currencyUomId (OFBIZ-11033)
7996d14 is described below

commit 7996d142b53e103f0db311a36cc6ea3ba3d4cf2f
Author: Pawan Verma <[hidden email]>
AuthorDate: Thu Jan 30 18:55:01 2020 +0530

    Fixed: service 'loadSalesOrderItemFact' has hard coded currencyUomId
    (OFBIZ-11033)
   
    Used PartyAccountingPreference.baseCurrencyUomId instead of hard coded USD.
   
    Thanks: Pierre Smits for your contribution.
---
 bi/minilang/FactServices.xml | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/bi/minilang/FactServices.xml b/bi/minilang/FactServices.xml
index 3993573..408b93c 100644
--- a/bi/minilang/FactServices.xml
+++ b/bi/minilang/FactServices.xml
@@ -354,6 +354,16 @@ under the License.
             <!-- =============== -->
             <!-- facts handling  -->
             <!-- =============== -->
+            <script>groovy:
+                import org.apache.ofbiz.order.order.OrderReadHelper
+
+                orderReadHelper = new OrderReadHelper(orderHeader)
+                billFromParty = orderReadHelper.getBillFromParty()
+            </script>
+            <set field="partyAccountingPreferencesCallMap.organizationPartyId" from-field="billFromParty.partyId"/>
+            <call-service service-name="getPartyAccountingPreferences" in-map-name="partyAccountingPreferencesCallMap">
+                <result-to-field result-name="partyAccountingPreference" field="accPref"/>
+            </call-service>
             <set field="fact.quantity" from-field="orderItem.quantity" type="BigDecimal"/>
             <set field="fact.extGrossAmount" value="0" type="BigDecimal"/>
             <set field="fact.extGrossCost" value="0" type="BigDecimal"/>
@@ -374,7 +384,7 @@ under the License.
 
             <!-- extGrossAmount -->
             <set field="convertUomCurrencyMap.uomId" from-field="orderHeader.currencyUom"/>
-            <set field="convertUomCurrencyMap.uomIdTo" value="USD"/>
+            <set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
             <set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
             <call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
                 <result-to-field result-name="conversionFactor" field="exchangeRate"/>
@@ -406,7 +416,7 @@ under the License.
                 <first-from-list list="costs" entry="cost"/>
 
                 <set field="convertUomCurrencyMap.uomId" from-field="cost.currencyUomId"/>
-                <set field="convertUomCurrencyMap.uomIdTo" value="USD"/>
+                <set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
                 <set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
                 <call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
                     <result-to-field result-name="conversionFactor" field="exchangeRate"/>
@@ -492,7 +502,7 @@ under the License.
             </iterate>
             <if-compare field="countGS" operator="equals" value="0">
                 <set field="convertUomCurrencyMap.uomId" from-field="orderHeader.currencyUom"/>
-                <set field="convertUomCurrencyMap.uomIdTo" value="USD"/>
+                <set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
                 <set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
                 <call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
                     <result-to-field result-name="conversionFactor" field="exchangeRate"/>
@@ -555,7 +565,7 @@ under the License.
                 </calculate>
 
                 <set field="convertUomCurrencyMap.uomId" from-field="orderHeader.currencyUom"/>
-                <set field="convertUomCurrencyMap.uomIdTo" value="USD"/>
+                <set field="convertUomCurrencyMap.uomIdTo" from-field="accPref.baseCurrencyUomId"/>
                 <set field="convertUomCurrencyMap.nowDate" from-field="orderStatus.statusDatetime"/>
                 <call-service service-name="convertUomCurrency" in-map-name="convertUomCurrencyMap">
                     <result-to-field result-name="conversionFactor" field="exchangeRate"/>