[jira] [Commented] (OFBIZ-6330) The invoiceTaxTotal value is missing from createAcctgTransForPurchaseInvoice service

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

[jira] [Commented] (OFBIZ-6330) The invoiceTaxTotal value is missing from createAcctgTransForPurchaseInvoice service

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-6330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15860379#comment-15860379 ]

Paul Foxworthy commented on OFBIZ-6330:
---------------------------------------

Thanks Christian,

Sorry, duh, I shoulda got the package name right. New patch attached.

I'm leaning towards Nicolas's suggestion to avoid the call to getInvoiceTaxTotal and just add up the tax amounts. We want the accounting transaction to balance debits and credits. If we just add up the tax amounts, we are surer everything will balance, compared to trusting getInvoiceTaxTotal. And we avoid one method call, so the service would be fractionally faster.

Jacopo and Christian, what do you think?

People did discover the problem (OFBIZ-4514 and OFBIZ-5936), but a fix was never committed. If we had reasonable tests ("does the accounting transaction balance?"), we'd have highlighted how flawed these services were years ago. Anyone want to work on some tests now?



> The invoiceTaxTotal value is missing from createAcctgTransForPurchaseInvoice service
> ------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-6330
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6330
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting
>    Affects Versions: Trunk
>            Reporter: Kongrath Suankaewmanee
>            Assignee: Paul Foxworthy
>         Attachments: GeneralLedgerServices.patch, OFBIZ-6330_TaxAccountingOnPurchasesAndReturns.patch, OFBIZ-6330_TaxAccountingOnPurchasesAndReturns.patch
>
>
> Hi All,
> Scenario: The sum of debit and credit in InvoiceAcctgTransEntriesPdf of purchase invoice are not equal.
> Question: I'm not sure why the createAcctgTransForPurchaseInvoice service did not call the method to get invoiceTaxTotal.
> <call-class-method method-name="getInvoiceTaxTotal" class-name="org.ofbiz.accounting.invoice.InvoiceWorker" ret-field="invoiceTaxTotal">
>     <field field="invoice" type="GenericValue"/>
> </call-class-method>
> And the invoiceTaxTotal value needs to add to totalAmountFromInvoice via code below:
> <calculate field="totalAmountFromInvoice" type="BigDecimal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
>     <calcop operator="add">
>         <calcop operator="get" field="totalAmountFromInvoice"/>
>         <calcop operator="get" field="invoiceTaxTotal"/>
>     </calcop>
> </calculate>
> That it should work like the createAcctgTransForSalesInvoice service of the sales invoice.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)