[jira] [Commented] (OFBIZ-7147) Remove parentTypeId from InvoiceType data where InvoiceTypeId and parentTypeId are equal

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

[jira] [Commented] (OFBIZ-7147) Remove parentTypeId from InvoiceType data where InvoiceTypeId and parentTypeId are equal

Nicolas Malin (Jira)

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

Vikas Mayur commented on OFBIZ-7147:
------------------------------------

Hi Jacques,

I found this issue with the migration of OFBiz 12 to OFBiz 16. Here is the part of the error stack trace.

{code}
017-10-17 21:49:00,959 |http-nio-8443-exec-3 |ServiceEcaRule                |I| Running Service ECA Service: createAcctgTransForPurchaseInvoice, triggered by rule on Service: setInvoiceStatus
2017-10-17 21:49:00,960 |http-nio-8443-exec-3 |Log                           |I| [GeneralLedgerServices.xml#getGlArithmeticSettingsInline line 2823] Got settings from arithmetic.properties: ledgerDecimals=4, roundingMode=HalfUp
2017-10-17 21:49:01,068 |http-nio-8443-exec-3 |UtilProperties                |I| ResourceBundle MiniLangErrorUiLabels (en) created in 0.042s with 4 properties
2017-10-17 21:49:01,069 |http-nio-8443-exec-3 |TransactionUtil               |W| Calling transaction setRollbackOnly; this stack trace shows where this is happening:
java.lang.Exception: Error in simple-method [Create an accounting transaction for a purchase invoice [file:/Users/vikas/work/projects/rel16/applications/accounting/minilang/ledger/GeneralLedgerServices.xml#createAcctgTransForPurchaseInvoice]]: Error running the simple-method: nullnull
        at org.apache.ofbiz.entity.transaction.TransactionUtil.setRollbackOnly(TransactionUtil.java:361) [ofbiz.jar:?]
        at org.apache.ofbiz.entity.transaction.TransactionUtil.rollback(TransactionUtil.java:302) [ofbiz.jar:?]
        at org.apache.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:581) [ofbiz.jar:?]
        at org.apache.ofbiz.minilang.SimpleMethod.runSimpleMethod(SimpleMethod.java:274) [ofbiz.jar:?]
        at org.apache.ofbiz.minilang.SimpleMethod.runSimpleService(SimpleMethod.java:293) [ofbiz.jar:?]
        at org.apache.ofbiz.minilang.SimpleServiceEngine.serviceInvoker(SimpleServiceEngine.java:79) [ofbiz.jar:?]
        at org.apache.ofbiz.minilang.SimpleServiceEngine.runSync(SimpleServiceEngine.java:48) [ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:395) [ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:227) [ofbiz.jar:?]
        at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:88) [ofbiz.jar:?]
        at org.apache.ofbiz.service.eca.ServiceEcaAction.runAction(ServiceEcaAction.java:128) [ofbiz.jar:?]
        at org.apache.ofbiz.service.eca.ServiceEcaRule.eval(ServiceEcaRule.java:159) [ofbiz.jar:?]
        at org.apache.ofbiz.service.eca.ServiceEcaUtil.evalRules(ServiceEcaUtil.java:190) [ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:492) [ofbiz.jar:?]
        at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:227) [ofbiz.jar:?]
        at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:88) [ofbiz.jar:?]
        at org.apache.ofbiz.accounting.invoice.InvoiceServices.createInvoiceForOrder(InvoiceServices.java:874) [ofbiz.jar:?]
{code}
The chain of events that lead to this error occurs when you pack and ship a sales order.  The error come from the following code of the service 'createAcctgTransForPurchaseInvoice' (triggered on the service eca 'setInvoiceStatus')
{code}
        <set field="isPurchaseInvoice" value="${groovy: org.apache.ofbiz.entity.util.EntityTypeUtil.hasParentType(delegator, 'InvoiceType', 'invoiceTypeId', invoice.getString('invoiceTypeId'), 'parentTypeId', 'PURCHASE_INVOICE')}" type="Boolean"/>
{code}

It looks like the method hasParentType() does not return gracefully. I did not look further but running the following update statement fix the issue.

{code}
update invoice_type set parent_type_id = 'INVOICE' where invoice_type_id = 'SALES_INVOICE';
update invoice_type set parent_type_id = 'INVOICE' where invoice_type_id = 'PURCHASE_INVOICE';
update invoice_type set parent_type_id = 'INVOICE' where invoice_type_id = 'TEMPLATE';
{code}

I hope that helps!

Regards
Vikas




> Remove parentTypeId from InvoiceType data where InvoiceTypeId and parentTypeId are equal
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-7147
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-7147
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting
>    Affects Versions: Release Branch 14.12, Trunk, Release Branch 15.12
>            Reporter: Arun Patidar
>            Assignee: Jacques Le Roux
>             Fix For: 14.12.01, 15.12.01, 13.07.04
>
>         Attachments: OFBIZ-7147.patch
>
>
> In InvoiceType data, we have invoiceTypeId value with same parentTypeId.
> Please refer AccountingTypeData.xml.
> <InvoiceType description="Purchase Invoice" hasTable="N" invoiceTypeId="PURCHASE_INVOICE"  parentTypeId="PURCHASE_INVOICE"/>
> <InvoiceType description="Sales Invoice" hasTable="N" invoiceTypeId="SALES_INVOICE" parentTypeId="SALES_INVOICE"/>
> Here, invoiceTypeId="PURCHASE_INVOICE"  has "PURCHASE_INVOICE" as its parentTypeId. Same applies for invoiceTypeId="SALES_INVOICE"
> This also causes issue of infinite loop with EntityTypeUtil.hasParentType() method.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)