metasfresh / metasfresh-webui-frontend-legacy

metasfresh Webui Frontend
GNU General Public License v2.0
57 stars 34 forks source link

hu lines appear only after refresh #1216

Closed metas-lc closed 7 years ago

metas-lc commented 7 years ago

Type of issue

Bug

Current behavior

HU lines are not visible after you complete a document

Expected behavior

HU lines should appear right after you complete a document

Steps to reproduce

  1. create any document: e.g. purchase order you can take this example https://w101.metasfresh.com:8443/window/181/1000016
  2. add a product with TU, complete => notice that the HU line is not shown NOK
  3. refresh the page => HU line is shown
teosarca commented 7 years ago

note to dev: The line it's not shown because the tab it's not refreshed. The tab it's not refreshed because somehow frontend it's not listening or it's not reacting to document's websocket events (check /document/{windowId}/{documentId} websocket topic).

the websocket endpoint it's provided when the document is loaded, e.g. image

ottosichert commented 7 years ago

Notes to dev:

ottosichert commented 7 years ago

Right now this must be a backend issue

  1. Create new purchase order
  2. Create new purchase order line
  3. Select product
  4. Select HU
  5. Save
    • => OK: Product appears in list
    • => NOK: HU does not appear in list
    • => NOK: HU does not appear in list even after refreshing!

When this issue is resolved, i can continue with the refreshing issue

teosarca commented 7 years ago

@ottosichert u need to complete the purchase order

ottosichert commented 7 years ago

@teosarca thanks for the advice.

I could narrow down the issue to no websocket message firing back after completing via sessionClient or notificationClient (e.g. to ws://w101.metasfresh.com:8081/stomp/445/oynldn2p/websocket).

  1. Create new purchase order
  2. Create new purchase order line
  3. Select product
  4. Select HU
  5. Save
  6. Complete
    • => OK: PATCH request is sent to http://w101.metasfresh.com:8081/rest/api/window/181/1000016
      [{"op":"replace","path":"DocAction","value":{"CO":"Fertigstellen"}}]
    • => OK: Response 200
      [{"windowId":"181","id":"1000016","fieldsByName":{"DocStatus":{"field":"DocStatus","value":{"CO":"Fertiggestellt"},"widgetType":"List"},"DocAction":{"field":"DocAction","value":{"RE":"Reaktivieren"},"widgetType":"Button"},"V$DocumentSummary":{"field":"V$DocumentSummary","value":"820472","widgetType":"Text"},"M_Warehouse_ID":{"field":"M_Warehouse_ID","readonly":true,"widgetType":"List"},"C_DocTypeTarget_ID":{"field":"C_DocTypeTarget_ID","readonly":true,"widgetType":"List"},"AD_Org_ID":{"field":"AD_Org_ID","readonly":true,"widgetType":"List"},"DocumentNo":{"field":"DocumentNo","readonly":true,"widgetType":"Text"},"DateOrdered":{"field":"DateOrdered","readonly":true,"widgetType":"Date"},"DatePromised":{"field":"DatePromised","readonly":true,"widgetType":"DateTime"},"PreparationDate":{"field":"PreparationDate","readonly":true,"widgetType":"DateTime"},"LotNumberDate":{"field":"LotNumberDate","readonly":true,"widgetType":"Date"},"C_BPartner_ID":{"field":"C_BPartner_ID","readonly":true,"widgetType":"Lookup"},"Bill_BPartner_ID":{"field":"Bill_BPartner_ID","readonly":true,"widgetType":"List"},"C_BPartner_Location_ID":{"field":"C_BPartner_Location_ID","readonly":true,"widgetType":"List"},"Bill_Location_ID":{"field":"Bill_Location_ID","readonly":true,"widgetType":"List"},"AD_User_ID":{"field":"AD_User_ID","readonly":true,"widgetType":"List"},"Bill_User_ID":{"field":"Bill_User_ID","readonly":true,"widgetType":"List"},"IsDropShip":{"field":"IsDropShip","readonly":true,"widgetType":"YesNo"},"DropShip_BPartner_ID":{"field":"DropShip_BPartner_ID","readonly":true,"widgetType":"Lookup"},"DropShip_Location_ID":{"field":"DropShip_Location_ID","readonly":true,"widgetType":"List"},"DropShip_User_ID":{"field":"DropShip_User_ID","readonly":true,"widgetType":"List"},"M_PricingSystem_ID":{"field":"M_PricingSystem_ID","readonly":true,"widgetType":"List"},"AD_Client_ID":{"field":"AD_Client_ID","readonly":true,"widgetType":"List"}},"includedTabsInfo":{"1":{"tabid":"1","stale":true,"allowCreateNew":false,"allowCreateNewReason":"ParentDocumentProcessed","allowDelete":false,"allowDeleteReason":"ParentDocumentProcessed"},"2":{"tabid":"2","stale":true}},"websocketEndpoint":"/document/181/1000016"}]
    • => OK: UI updates and shows Completed on top right
    • => NOK: No websocket message is sent (besides h every 25s) bildschirmfoto vom 2017-10-06 21-56-52 (picture shows userSession, same goes for notifications)
    • => NOK: Sales order items stay the same, no HU line is added

There are no websocket messages as well when a completed sales order is re-activated (sent back to draft).

The only other websocket connection is to ws://w101.metasfresh.com:8081/socket.io/?EIO=3&transport=websocket&sid=585-EsVA0TgWDqojAAAt but there are no messages as well besides a back and forth of 2 and 3 every 25s. bildschirmfoto vom 2017-10-06 22-01-19

Are there supposed to be more websocket connections I missed out? Otherwise thats the problem

teosarca commented 7 years ago

@ottosichert thanks for research... I will debug it on server side too... but yes, a websocket event shall be sent by backend and frontend shall react to it and shall refresh the document/tab.

teosarca commented 7 years ago

@ottosichert quick checked but it's frontend. Take a look:

image image

And in parallel i was using our websocket test client (i.e. http://w101.metasfresh.com:8081/websocket_test.html), where i've subscribed to document's websocket endpoint. Here i can see that the notification was correctly sent from backend.

image

ottosichert commented 7 years ago

Thanks @teosarca for your input. The websocket test client is helpful for investigating this issue.

The problem is that no websocket connection is established for this document. There are websocket connections for e.g. /notifications/100 and /userSession/100 but not for /document/181/1000016.

I will submit a PR for this issue

teosarca commented 7 years ago

@ottosichert hmm that's pretty awkward because that was working in the past. But i don't know how it was implemented.... maybe it was somewhere hardcoded to refresh the document after calling the DocAction button.....

metas-rc commented 7 years ago

Results of IT

OK: the HU line is displayed in the purchase order as soon as the order is completed.