Openbravo Issue Tracking System - Retail Modules
View Issue Details
0046429Retail ModulesWeb POSpublic2021-04-29 17:312021-06-02 09:24
vmromanos 
rqueralta 
normalmajoralways
closedfixed 
5
 
RR21Q3 
No
0046429: External Order Loader in cross store mode
The external order loader is failing when trying to work in a cross store environment. See this example:

{
  "messageId": "MessageId0144",
  "channel": "External",
  "posTerminal": "Magento",
  "data": [
    {
      "currency": "EUR",
      "payment": 135,
      "step": "create",
      "grossAmount": 135,
      "netAmount": 111.57,
      "documentStatus": "NC",
      "businessPartner": "WVG/C0002",
      "completeTicket": true,
      "organization": "B5DE96143D6642228E3B9DEC69886A47",
      "documentType": "91133D5715FA429C875334DB798D57A1",
      "transactionDocument": "91133D5715FA429C875334DB798D57A1",
      "warehouse" : "0B3E1D8D0FCB44FB81EA1A3FF158B086",
      "lines": [
        {
          "product": "WVG/L0014",
          "qty": 1,
          "grossAmount": 135,
          "netAmount": 111.57,
          "taxAmount": 23.43,
          "taxLines": {
            "Entregas IVA 21%": {
              "rate": 21,
              "netAmount": 111.57,
              "taxAmount": 23.43
            }
          }
        },
      ],
      "taxes": {
        "Entregas IVA 21%": {
          "rate": 21,
          "grossAmount": 135,
          "netAmount": 111.57,
          "taxAmount": 23.43
        }
      }
    }
  ]
}


We have registered a sale in "Magento" posTerminal, and we want to load a ticket in Posets Store with the Posets Store Warehouse, but linked to the Magento posTerminal. This is a common scenario when working with e-commerce and OMS, where the sale happens in an e-commerce solution and the order will be delivered by a different organization within the cross store.

If we try to load this JSON with the External Order Loader, it will fail with the following error:
"Value 0B3E1D8D0FCB44FB81EA1A3FF158B086 does not resolve to an instance of Warehouse"
Note that 0B3E1D8D0FCB44FB81EA1A3FF158B086 is the Posets Warehouse Id.

However, if we try to manually enter the ticket in the ERP it will work fine.


The problem is when the external order loader tries to find the warehouse [ExternalOrderLoader.resolve()]. In that moment it automatically adds a filter by the organization's natural tree to search for the warehouse from the provided ID. This looks OK, but the organization is taken from the posTerminal one (in our case Magento), so it fails because Posets is a Magento's sibling.
Try to load the above JSON using the External Order Loader.
An error "Value 0B3E1D8D0FCB44FB81EA1A3FF158B086 does not resolve to an instance of Warehouse" is returned
Two possible solution I see. Please evaluate them internally and decide the best approach:

1. If an organization is passed as part of the json file, use this organization to filter by its natural tree when resolving a json property.

2. Take the posTerminal organization and search for the related cross store organization. If defined, take it as the one for the filter.

I attached a proposed solution for the second option
DemoImprovementProgram
diff crossStore_ExternalOrderLoader.diff (1,073) 2021-04-29 17:31
https://issues.openbravo.com/file_download.php?file_id=15606&type=bug
Issue History
2021-04-29 17:31vmromanosNew Issue
2021-04-29 17:31vmromanosAssigned To => Retail
2021-04-29 17:31vmromanosFile Added: crossStore_ExternalOrderLoader.diff
2021-04-29 17:31vmromanosTriggers an Emergency Pack => No
2021-04-29 17:51marvintmResolution time => 1621461600
2021-05-04 07:31ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2021-05-04 07:32ranjith_qualiantech_comStatusnew => scheduled
2021-05-10 07:20ranjith_qualiantech_comAssigned Toranjith_qualiantech_com => Retail
2021-05-10 16:03rqueraltaAssigned ToRetail => rqueralta
2021-05-13 05:58hgbotNote Added: 0128052
2021-05-24 06:42marvintmResolution time1621461600 => 1622066400
2021-05-26 22:02hgbotNote Added: 0128688
2021-05-27 11:59xplacescTag Attached: DemoImprovementProgram
2021-06-01 00:31hgbotNote Added: 0128826
2021-06-01 15:13hgbotNote Added: 0128863
2021-06-01 22:28hgbotNote Added: 0128892
2021-06-02 09:24hgbotResolutionopen => fixed
2021-06-02 09:24hgbotStatusscheduled => closed
2021-06-02 09:24hgbotFixed in Version => RR21Q3
2021-06-02 09:24hgbotNote Added: 0128921
2021-06-02 09:24hgbotNote Added: 0128922

Notes
(0128052)
hgbot   
2021-05-13 05:58   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/412 [^]
(0128688)
hgbot   
2021-05-26 22:02   
Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/412 [^]
(0128826)
hgbot   
2021-06-01 00:31   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/442 [^]
(0128863)
hgbot   
2021-06-01 15:13   
Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/442 [^]
(0128892)
hgbot   
2021-06-01 22:28   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/449 [^]
(0128921)
hgbot   
2021-06-02 09:24   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: edf313e955b2110314432fc801f25ada77fe4578
Author: Rafael Queralta <rafaelcuba81@gmail.com>
Date: 2021-06-02T07:22:47+00:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/edf313e955b2110314432fc801f25ada77fe4578 [^]

Fixed BUG-46429: Taking the related cross store organization if defined instead the POS organization and the the new preference is Y too

---
M src-db/database/sourcedata/AD_PREFERENCE.xml
M src-db/database/sourcedata/AD_REF_LIST.xml
M src/org/openbravo/retail/posterminal/ExternalOrderLoader.java
---
(0128922)
hgbot   
2021-06-02 09:24   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/449 [^]