Unable to Register Payment from a Supplier Purchase Invoice

Hello Team,

I have axelor-open-suite latest version installed and have setup the accounting module including fixed assets. However, when I try to register payment from a supplier purchase invoice that already got validated and ventilated, I get a null pointer exception.
When I look through the null pointer exception, it appears that an instance of InvoicePayment class is null when it is being called by validate() method in the InvoicePaymentValidateServiceImpl class
I’m suspecting it’s a configuration issue because I don’t get this challenge when I import and use the demo data
I will be grateful for any help in resolving this issue. Screenshots of the invoice and account configuration can be seen below.

  1. Invoice Screenshot

  2. Invoice Line Screenshot

  3. Payment popup screen when I click on Register Payment

  4. Null Pointer Exception screen when I click on the OK button on the Payment Screen

  5. Invoice Configuration on account

Will be willing to provide any other information that will be required for express help

Hello
I guess you forgotten to configure something
Can you please post the entire stacktrace error. (Expecially the caused by part.)

Many Thanks Fabio,

Kindly find below the full stacktrace - first the cause part.

  1. Cause part

java.lang.NullPointerException
at com.axelor.apps.bankpayment.service.invoice.payment.InvoicePaymentValidateServiceBankPayImpl.validate(InvoicePaymentValidateServiceBankPayImpl.java:95)
at com.axelor.apps.businessproject.service.InvoicePaymentValidateProjectServiceImpl.validate(InvoicePaymentValidateProjectServiceImpl.java:77)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.service.payment.invoice.payment.InvoicePaymentValidateServiceImpl.validate(InvoicePaymentValidateServiceImpl.java:129)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:31)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:26)
at com.axelor.apps.bankpayment.service.invoice.payment.InvoicePaymentValidateServiceBankPayImpl.validate(InvoicePaymentValidateServiceBankPayImpl.java:140)
at com.axelor.apps.businessproject.service.InvoicePaymentValidateProjectServiceImpl.validate(InvoicePaymentValidateProjectServiceImpl.java:77)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.service.payment.invoice.payment.InvoicePaymentValidateServiceImpl.validate(InvoicePaymentValidateServiceImpl.java:129)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:31)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:26)
at com.axelor.rpc.Resource.save(Resource.java:1004)
at com.axelor.rpc.ResponseInterceptor.invoke(ResponseInterceptor.java:56)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:64)
at com.axelor.web.service.RestService.save(RestService.java:167)
at com.axelor.rpc.RequestFilter.invoke(RequestFilter.java:55)
at com.axelor.rpc.ResponseInterceptor.invoke(ResponseInterceptor.java:65)
at sun.reflect.GeneratedMethodAccessor765.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:294)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:248)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:235)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:398)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:205)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:228)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:89)
at com.axelor.db.tenants.AbstractTenantFilter.doFilter(AbstractTenantFilter.java:70)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:44)
at io.buji.pac4j.filter.SecurityFilter.lambda$doFilter$0(SecurityFilter.java:86)
at org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:140)
at com.axelor.auth.pac4j.AuthPac4jModule$AxelorSecurityFilter$1.perform(AuthPac4jModule.java:479)
at com.axelor.auth.pac4j.AuthPac4jModule$AxelorSecurityFilter$1.perform(AuthPac4jModule.java:463)
at io.buji.pac4j.filter.SecurityFilter.doFilter(SecurityFilter.java:84)
at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:41)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.axelor.app.internal.AppFilter.doFilter(AppFilter.java:94)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:94)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.axelor.db.tenants.AbstractTenantFilter.doFilter(AbstractTenantFilter.java:70)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.axelor.web.servlet.CorsFilter.doFilter(CorsFilter.java:137)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:201)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:698)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:364)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:616)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1629)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

  1. Main Exception

javax.persistence.PersistenceException: javax.persistence.PersistenceException: java.lang.NullPointerException
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:35)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:26)
at com.axelor.rpc.Resource.save(Resource.java:1004)
at com.axelor.rpc.ResponseInterceptor.invoke(ResponseInterceptor.java:56)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:64)
at com.axelor.web.service.RestService.save(RestService.java:167)
at com.axelor.rpc.RequestFilter.invoke(RequestFilter.java:55)
at com.axelor.rpc.ResponseInterceptor.invoke(ResponseInterceptor.java:65)
at sun.reflect.GeneratedMethodAccessor765.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:294)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:248)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:235)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:398)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:205)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:228)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:89)
at com.axelor.db.tenants.AbstractTenantFilter.doFilter(AbstractTenantFilter.java:70)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:44)
at io.buji.pac4j.filter.SecurityFilter.lambda$doFilter$0(SecurityFilter.java:86)
at org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:140)
at com.axelor.auth.pac4j.AuthPac4jModule$AxelorSecurityFilter$1.perform(AuthPac4jModule.java:479)
at com.axelor.auth.pac4j.AuthPac4jModule$AxelorSecurityFilter$1.perform(AuthPac4jModule.java:463)
at io.buji.pac4j.filter.SecurityFilter.doFilter(SecurityFilter.java:84)
at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:41)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.axelor.app.internal.AppFilter.doFilter(AppFilter.java:94)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:94)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.axelor.db.tenants.AbstractTenantFilter.doFilter(AbstractTenantFilter.java:70)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.axelor.web.servlet.CorsFilter.doFilter(CorsFilter.java:137)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:201)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:698)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:364)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:616)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1629)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.persistence.PersistenceException: java.lang.NullPointerException
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:35)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:26)
at com.axelor.apps.bankpayment.service.invoice.payment.InvoicePaymentValidateServiceBankPayImpl.validate(InvoicePaymentValidateServiceBankPayImpl.java:140)
at com.axelor.apps.businessproject.service.InvoicePaymentValidateProjectServiceImpl.validate(InvoicePaymentValidateProjectServiceImpl.java:77)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.service.payment.invoice.payment.InvoicePaymentValidateServiceImpl.validate(InvoicePaymentValidateServiceImpl.java:129)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:31)
… 72 more
Caused by: java.lang.NullPointerException
at com.axelor.apps.bankpayment.service.invoice.payment.InvoicePaymentValidateServiceBankPayImpl.validate(InvoicePaymentValidateServiceBankPayImpl.java:95)
at com.axelor.apps.businessproject.service.InvoicePaymentValidateProjectServiceImpl.validate(InvoicePaymentValidateProjectServiceImpl.java:77)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.service.payment.invoice.payment.InvoicePaymentValidateServiceImpl.validate(InvoicePaymentValidateServiceImpl.java:129)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
at com.axelor.apps.account.db.repo.InvoicePaymentManagementRepository.save(InvoicePaymentManagementRepository.java:31)
… 79 more

1 J'aime

Hello
From that stacktrace I can see that invoicePayment is NULL so you get a NullPointerException
Have a look at my attached image (line 95)

Hello Team,

I found the issue after reading through tons of code.
Like we suspected earlier on, it was a configuration issue.
Basically, the designated account for suppliers will have to be set to reconcile.
In addition, sequences have to be set for the company for Reconcile, Letter (Draft) and Letter (Final).
Once these are done, the null pointer exception will disappear. See screenshots below:

  1. Account Reconcile Enablement

  1. Company Sequence for Reconcile

  2. Company Sequence for Letter (Draft)

  3. Company Sequence for Letter (Final)

Decided to share for all who may be having the same or similar challenge.
Thanks for your support

2 J'aimes

I will try this solution, it was something I tried many times

1 J'aime