Bug fix in GL posting of purchase invoice. Don't add add entry for tax that was not on invoice.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1001962 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anil Patel
2010-09-27 23:27:47 +00:00
parent b7824cddca
commit 4950bd2a00
@@ -2127,18 +2127,26 @@ under the License.
</iterate>
</iterate-map>
<!-- Another entry for tax not attributed to a taxAuthPartyId -->
<clear-field field="debitEntry"/>
<make-value entity-name="AcctgTransEntry" value-field="debitEntry"/>
<set field="debitEntry.debitCreditFlag" value="D"/>
<set field="debitEntry.organizationPartyId" from-field="invoice.partyId"/>
<call-class-method method-name="getInvoiceUnattributedTaxTotal" class-name="org.ofbiz.accounting.invoice.InvoiceWorker"
ret-field="taxAmount">
<field field="invoice" type="GenericValue"/>
</call-class-method>
<set field="debitEntry.origAmount" from-field="taxAmount"/>
<set field="debitEntry.origCurrencyUomId" from-field="invoice.currencyUomId"/>
<set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/>
<if>
<condition>
<and>
<if-compare field="taxAmount" operator="greater" value="0" type="BigDecimal"/>
</and>
</condition>
<then>
<clear-field field="debitEntry"/>
<make-value entity-name="AcctgTransEntry" value-field="debitEntry"/>
<set field="debitEntry.debitCreditFlag" value="D"/>
<set field="debitEntry.organizationPartyId" from-field="invoice.partyId"/>
<set field="debitEntry.origAmount" from-field="taxAmount"/>
<set field="debitEntry.origCurrencyUomId" from-field="invoice.currencyUomId"/>
<set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/>
</then>
</if>
<!-- Credit -->
<make-value entity-name="AcctgTransEntry" value-field="creditEntry"/>
<set field="creditEntry.debitCreditFlag" value="C"/>