Author: arunpatidar
Date: Thu Jun 2 05:14:45 2016 New Revision: 1746524 URL: http://svn.apache.org/viewvc?rev=1746524&view=rev Log: [OFBIZ-7124] Fixed issue of Incorrect fetching of Invoice while creating paymentApplication from matching invoices. Thanks Anurag Chandak for your contribution. Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=1746524&r1=1746523&r2=1746524&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Thu Jun 2 05:14:45 2016 @@ -1014,10 +1014,12 @@ under the License. <log level="error" message="Invoice not found"/> <return/> </if-empty> - <if-compare field="invoice.parentTypeId" operator="equals" value="PURCHASE_INVOICE"> + <set field="isPurchaseInvoice" value="${groovy: org.ofbiz.entity.util.EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', invoice.getString('invoiceTypeId'), 'parentTypeId', 'PURCHASE_INVOICE')}" type="Boolean"/> + <set field="isSalesInvoice" value="${groovy: org.ofbiz.entity.util.EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', invoice.getString('invoiceTypeId'), 'parentTypeId', 'SALES_INVOICE')}" type="Boolean"/> + <if-compare field="isPurchaseInvoice" operator="equals" value="true" type="Boolean"> <set field="pref.organizationPartyId" from-field="invoice.partyId"/> </if-compare> - <if-compare field="invoice.parentTypeId" operator="equals" value="SALES_INVOICE"> + <if-compare field="isSalesInvoice" operator="equals" value="true" type="Boolean"> <set field="pref.organizationPartyId" from-field="invoice.partyIdFrom"/> </if-compare> <call-service service-name="getPartyAccountingPreferences" in-map-name="pref"> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=1746524&r1=1746523&r2=1746524&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Thu Jun 2 05:14:45 2016 @@ -1110,6 +1110,16 @@ under the License. <order-by field-name="invoiceDate"/> </entity-condition> <iterate entry="invoice" list="invoices"> + <set field="isPurchaseInvoice" value="${groovy: org.ofbiz.entity.util.EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', invoice.getString('invoiceTypeId'), 'parentTypeId', 'PURCHASE_INVOICE')}" type="Boolean"/> + <set field="isSalesInvoice" value="${groovy: org.ofbiz.entity.util.EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', invoice.getString('invoiceTypeId'), 'parentTypeId', 'SALES_INVOICE')}" type="Boolean"/> + <if> + <condition> + <or> + <if-compare field="isPurchaseInvoice" operator="equals" value="true" type="Boolean"/> + <if-compare field="isSalesInvoice" operator="equals" value="true" type="Boolean"/> + </or> + </condition> + <then> <call-class-method method-name="getInvoiceTotal" class-name="org.ofbiz.accounting.invoice.InvoiceWorker" ret-field="invoiceTotal"> <field field="invoice" type="GenericValue"/> </call-class-method> @@ -1134,6 +1144,8 @@ under the License. </if-compare-field> </else> </if-compare> + </then> + </if> </iterate> <if-not-empty field="invoiceId"> <entity-and list="paymentAppls" entity-name="PaymentApplication"> |
Free forum by Nabble | Edit this page |