Fixed a series of bugs affecting payment applications; gl postings associated to payment application are now in a better shape (still need some enhancements).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@892447 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato
2009-12-19 07:55:44 +00:00
parent 150f2a54f9
commit c386b7f46d
4 changed files with 27 additions and 14 deletions
@@ -1924,12 +1924,9 @@ under the License.
<set field="creditEntry.origCurrencyUomId" from-field="origCurrencyUomId"/>
<if-not-empty field="paymentApplication.overrideGlAccountId">
<set field="creditEntry.glAccountId" from-field="paymentApplication.overrideGlAccountId"/>
<else>
<set field="creditEntry.glAccountId" from-field="payment.overrideGlAccountId"/>
</else>
</if-not-empty>
<set field="creditEntry.organizationPartyId" from-field="organizationPartyId"/>
<set field="creditEntry.glAccountTypeId" from-field="creditGlAccountTypeId"/>
<set field="creditEntry.glAccountTypeId" value="ACCOUNTS_RECEIVABLE"/>
<calculate field="amountAppliedTotal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
<calcop operator="add">
<calcop operator="get" field="amountAppliedTotal"/>
@@ -2251,7 +2248,7 @@ under the License.
<set field="debitEntry.debitCreditFlag" value="D"/>
<set field="debitEntry.origAmount" from-field="paymentApplication.amountApplied"/>
<set field="debitEntry.origCurrencyUomId" from-field="payment.currencyUomId"/>
<set field="debitEntry.glAccountTypeId" from-field="debitGlAccountTypeId"/>
<set field="debitEntry.glAccountTypeId" value="ACCOUNTS_PAYABLE"/>
<set field="debitEntry.organizationPartyId" from-field="organizationPartyId"/>
<if-not-empty field="paymentApplication.overrideGlAccountId">
<set field="debitEntry.glAccountId" from-field="paymentApplication.overrideGlAccountId"/>
@@ -2263,9 +2260,6 @@ under the License.
<field-map field-name="taxAuthPartyId" from-field="partyId"/>
</entity-one>
<set field="debitEntry.glAccountId" from-field="taxAuthorityGlAccount.glAccountId"/>
<else>
<set field="debitEntry.glAccountId" from-field="payment.overrideGlAccountId"/>
</else>
</if-not-empty>
</else>
</if-not-empty>
@@ -2354,14 +2348,22 @@ under the License.
<field-map field-name="paymentApplicationId" from-field="parameters.paymentApplicationId"/>
</entity-one>
<get-related-one value-field="paymentApplication" relation-name="Payment" to-value-field="payment"/>
<!-- if the payment transaction has not been already posted to gl then don't do nothing; the transaction for the payment application will be posted together with the payment -->
<if-compare field="payment.statusId" operator="equals" value="PMNT_NOT_PAID">
<return/>
</if-compare>
<call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="isReceipt" ret-field="isReceipt">
<field field="payment" type="org.ofbiz.entity.GenericValue"/>
</call-class-method>
<if-compare field="isReceipt" operator="equals" type="Boolean" value="true">
<!-- if the payment Credited account is already "accounts receivable" then don't do nothing -->
<entity-one entity-name="PaymentGlAccountTypeMap" value-field="paymentGlAccountTypeMap">
<field-map field-name="paymentTypeId" from-field="payment.paymentTypeId"/>
<field-map field-name="organizationPartyId" from-field="payment.partyIdTo"/>
</entity-one>
<if-compare field="paymentGlAccountTypeMap.glAccountTypeId" operator="equals" value="ACCOUNTS_RECEIVABLE">
<return/>
</if-compare>
<!--Debit -->
<make-value entity-name="AcctgTransEntry" value-field="debitEntry"/>
<set field="debitEntry.debitCreditFlag" value="D"/>
@@ -2372,7 +2374,7 @@ under the License.
<set field="debitEntry.origCurrencyUomId" from-field="payment.currencyUomId"/>
<set field="debitEntry.glAccountId" from-field="payment.overrideGlAccountId"/>
<set field="debitEntry.glAccountTypeId" from-field="paymentGlAccountTypeMap.glAccountTypeId"/>
<!-- Debit -->
<!-- Credit -->
<make-value entity-name="AcctgTransEntry" value-field="creditEntry"/>
<set field="creditEntry.debitCreditFlag" value="C"/>
<set field="creditEntry.organizationPartyId" from-field="payment.partyIdTo"/>
@@ -2382,10 +2384,14 @@ under the License.
<set field="creditEntry.origCurrencyUomId" from-field="payment.currencyUomId"/>
<set field="creditEntry.glAccountTypeId" value="ACCOUNTS_RECEIVABLE"/>
<else>
<!-- if the payment Debited account is already "accounts payable" then don't do nothing -->
<entity-one entity-name="PaymentGlAccountTypeMap" value-field="paymentGlAccountTypeMap">
<field-map field-name="paymentTypeId" from-field="payment.paymentTypeId"/>
<field-map field-name="organizationPartyId" from-field="payment.partyIdFrom"/>
</entity-one>
<if-compare field="paymentGlAccountTypeMap.glAccountTypeId" operator="equals" value="ACCOUNTS_PAYABLE">
<return/>
</if-compare>
<!--Credit -->
<make-value entity-name="AcctgTransEntry" value-field="creditEntry"/>
<set field="creditEntry.debitCreditFlag" value="C"/>
@@ -328,6 +328,11 @@ under the License.
<security https="true" auth="true"/>
<response name="success" type="view" value="editPaymentApplications"/>
</request-map>
<request-map uri="createPaymentApplication">
<security https="true" auth="true"/>
<event type="service" invoke="createPaymentApplication"/>
<response name="success" type="view" value="editPaymentApplications"/>
</request-map>
<request-map uri="updatePaymentApplication">
<security https="true" auth="true"/>
<event type="service" invoke="updatePaymentApplicationDef"/>
@@ -282,8 +282,10 @@ under the License.
</display-entity>
</field>
<field name="invoiceItemSeqId"><display/></field>
<field name="amountApplied"><text size="15"/></field>
<field name="amountApplied"><display/></field>
<!-- TODO: this is commented out because updating (instead of removing and recreating) payment application can cause wrong gl postings.
<field name="updateButton" widget-style="buttontext"><submit button-type="text-link"/></field>
-->
<field name="removeButton" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext">
<hyperlink description="${uiLabelMap.CommonRemove}" target="removePaymentApplication">
<parameter param-name="paymentApplicationId"/>
@@ -342,7 +344,7 @@ under the License.
</field>
</form>
<form name="listInvoicesNotApplied" type="list" list-name="invoices" target="updatePaymentApplication" title=""
<form name="listInvoicesNotApplied" type="list" list-name="invoices" target="createPaymentApplication" title=""
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<field name="paymentId"><hidden/></field>
<field name="invoiceId" widget-style="buttontext">
@@ -182,21 +182,21 @@ under the License.
<entity-condition entity-name="PaymentApplication" list="paymentApplicationsPay">
<condition-list combine="and">
<condition-expr field-name="paymentId" operator="equals" from-field="paymentId"/>
<condition-expr field-name="toPaymentId" operator="not-equals" from-field="null"/>
<condition-expr field-name="toPaymentId" operator="not-equals" from-field="nullField"/>
</condition-list>
<order-by field-name="toPaymentId"/>
</entity-condition>
<entity-condition entity-name="PaymentApplication" list="paymentApplicationsBil">
<condition-list combine="and">
<condition-expr field-name="paymentId" from-field="paymentId"/>
<condition-expr field-name="billingAccountId" operator="not-equals" from-field="null"/>
<condition-expr field-name="billingAccountId" operator="not-equals" from-field="nullField"/>
</condition-list>
<order-by field-name="billingAccountId"/>
</entity-condition>
<entity-condition entity-name="PaymentApplication" list="paymentApplicationsTax">
<condition-list combine="and">
<condition-expr field-name="paymentId" from-field="paymentId"/>
<condition-expr field-name="taxAuthGeoId" operator="not-equals" from-field="null"/>
<condition-expr field-name="taxAuthGeoId" operator="not-equals" from-field="nullField"/>
</condition-list>
<order-by field-name="taxAuthGeoId"/>
</entity-condition>