Openbravo Issue Tracking System - POS2
View Issue Details
0058344POS2POSpublic2025-03-12 17:122025-03-26 12:32
kchoperena 
NaroaIriarte 
highmajoralways
closedfixed 
5
 
25Q1.125Q1 
guilleaer
OBPS
No
0058344: The alternateInvoiceLocation and alternateShippingLocation are created at the organization level of the store
When an external CRM is used, the alternate invoice and shipping location are created to be used in the order

These locations are created behind the organization that is using the first time. The main problem is that a store located on another organization tree can use the location for an order and the import process will fail because of a luck of permissions

The impact is huge as any client that already was assigned can't create an order on another store for the same shipping and invoicing location. This scenario is so common in a E-commerce integration context

ERROR STACKTRACE:
org.openbravo.base.exception.OBSecurityException: Entity OR09901/0000023 - 12-03-2025 - 4643.89 (Order) with organization 801-V1-Online references an entity Carrer de Arago 65 - 1 3 - 08010 - LILLE - - Spain through its property Order.alternateLocation but this referenced entity belongs to an organization 802-VG-Girona which is not part of the natural tree of 801-V1-Online
    at org.openbravo.dal.core.OBInterceptor.checkReferencedOrganizations(OBInterceptor.java:316)
    at org.openbravo.dal.core.OBInterceptor.onFlushDirty(OBInterceptor.java:189)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:376)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:353)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:304)
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:175)
    at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
    at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:229)
    at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:93)
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
    at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1407)
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1394)
    at org.openbravo.dal.service.OBDal.flush(OBDal.java:266)
    at org.openbravo.retail.posterminal.OrderLoader.handlePayments(OrderLoader.java:1743)
    at org.openbravo.retail.posterminal.OrderLoader.saveRecord(OrderLoader.java:584)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.saveRecord(DataSynchronizationProcess.java:214)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.exec(DataSynchronizationProcess.java:165)
    at org.openbravo.retail.posterminal.ExternalOrderLoader.exec(ExternalOrderLoader.java:293)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.exec(DataSynchronizationProcess.java:97)
    at org.openbravo.retail.posterminal.ExternalOrderLoader.exec(ExternalOrderLoader.java:282)
    at org.openbravo.mobile.core.process.JSONProcessSimple.exec(JSONProcessSimple.java:47)
    at org.openbravo.retail.posterminal.ExternalOrderLoader.executeCreateImportEntry(ExternalOrderLoader.java:249)
    at org.openbravo.mobile.core.process.MobileServiceProcessor.execProcess(MobileServiceProcessor.java:162)
    at org.openbravo.mobile.core.process.MobileServiceProcessor.execServiceName(MobileServiceProcessor.java:139)
    at org.openbravo.mobile.core.process.MobileService.doGetOrPost(MobileService.java:218)
    at org.openbravo.mobile.core.process.MobileService.doPost(MobileService.java:75)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
    at org.openbravo.base.HttpBaseServlet.serviceInitialized(HttpBaseServlet.java:200)
    at org.openbravo.base.secureApp.HttpSecureAppServlet.service(HttpSecureAppServlet.java:236)
    at org.openbravo.client.kernel.BaseKernelServlet.callServiceInSuper(BaseKernelServlet.java:89)
    at org.openbravo.mobile.core.process.WebServiceAuthenticatedServlet.service(WebServiceAuthenticatedServlet.java:67)
    at org.openbravo.mobile.core.process.MobileService.service(MobileService.java:144)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.openbravo.utils.SessionExpirationFilter.doFilter(SessionExpirationFilter.java:66)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.openbravo.utils.CharsetFilter.doFilter(CharsetFilter.java:38)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.openbravo.client.kernel.KernelFilter$1.doAction(KernelFilter.java:65)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:47)
    at org.openbravo.client.kernel.KernelFilter.doFilter(KernelFilter.java:74)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.openbravo.dal.core.DalRequestFilter$1.doAction(DalRequestFilter.java:96)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:47)
    at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:118)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1735)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:829)
PRE-REQUIREMENTS:
1.- Use an external CRM connector. Maybe with the internal version is also failing but the issue was reproduced using an external one
2.- Have configured two organizations that are not part of the same org tree

STEPS:
1.- On the store A, log into the Web POS
2.- Create an order with a client assigned and a Home Delivery line that needs a shipping address and also select the Issue Invoice option from the ticket menu
3.- Complete the order and go to the back-end
4.- Check in the back-end that the order you have been created has filled the alternate shipping and invoicing locations
5.- Connect to another POS that belongs to the store B
6.- Create another ticket using exactly the same data
7.- Complete the ticket

RESULT:
The order import will fail in the data import entry queue with the error mentioned above
a mechanism exists to detect same address and not create new locations for the same data.
When location is found and it is assigned to an order form other organization it fails.

alternate locations should be created at * level
No tags attached.
blocks defect 0058221 closed NaroaIriarte The alternateInvoiceLocation and alternateShippingLocation are created at the organization level of the store 
Issue History
2025-03-25 19:04guilleaerTypedefect => backport
2025-03-25 19:04guilleaerTarget Version => 25Q1.1
2025-03-26 12:31guilleaerNote Added: 0177268
2025-03-26 12:31guilleaerStatusscheduled => resolved
2025-03-26 12:31guilleaerFixed in Version => 25Q1
2025-03-26 12:31guilleaerResolutionopen => fixed
2025-03-26 12:32guilleaerReview Assigned To => guilleaer
2025-03-26 12:32guilleaerStatusresolved => closed

Notes
(0177268)
guilleaer   
2025-03-26 12:31   
https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/65eae12bcce803edabd939a710b90004060677a1 [^]