Openbravo Issue Tracking System - Retail Modules
View Issue Details
0051553Retail ModulesRetail APIpublic2023-02-09 13:222023-02-13 11:41
nicola_uva 
vmromanos 
immediatemajoralways
closedfixed 
5
pi 
pi 
approved
Gold
No
0051553: Inventory API - When we have 2 products same searckey on different organization, we cannot do an inventory
When we have 2 products same searckey on different organizations, we cannot do an inventory on the product.
1) Configure in the backoffice 2 products with same searchkey and different orgs
1.1) product search key 123, name "Product 1" org *
1.2) product search key 123, name "Product 2", org "Vall Blanca Store"
2) Execute a call to the "Inventory" API endpoint, to create a inventory for a product defined in "Vall Blanca Store"
3)Edl "Inventory" in error

The code fail on this method
org.openbravo.api.mappings.inventoryline.ImportInventoryLineJavaPropertyMappingHandler.setInventoryLineProduct(InventoryCountLine, Object)
When we find a product must be added as filter the organization.
Product search key is not a global unique. global unique should be org and product key
No tags attached.
related to defect 0051547pi closed caristu PriceList API - Product price is wrongly added when same products searchKey on different Orgs are in OB backoffice 
Issue History
2023-02-09 13:22nicola_uvaNew Issue
2023-02-09 13:22nicola_uvaAssigned To => Triage Omni OMS
2023-02-09 13:22nicola_uvaOBNetwork customer => Gold
2023-02-09 13:22nicola_uvaTriggers an Emergency Pack => No
2023-02-09 14:28aferrazAssigned ToTriage Omni OMS => Triage Omni WMS
2023-02-09 17:33vmromanosNote Added: 0146332
2023-02-09 17:33vmromanosRelationship addedrelated to 0051547
2023-02-09 17:42vmromanosNote Edited: 0146332bug_revision_view_page.php?bugnote_id=0146332#r25515
2023-02-10 14:57vmromanosStatusnew => scheduled
2023-02-10 14:57vmromanosAssigned ToTriage Omni WMS => vmromanos
2023-02-10 15:00hgbotMerge Request Status => open
2023-02-10 15:00hgbotNote Added: 0146391
2023-02-10 15:02hgbotNote Added: 0146393
2023-02-13 10:44hgbotMerge Request Statusopen => approved
2023-02-13 11:41hgbotNote Added: 0146431
2023-02-13 11:41hgbotResolutionopen => fixed
2023-02-13 11:41hgbotStatusscheduled => closed
2023-02-13 11:41hgbotNote Added: 0146432
2023-02-13 11:41hgbotNote Added: 0146433
2023-02-13 11:41hgbotNote Added: 0146434

Notes
(0146332)
vmromanos   
2023-02-09 17:33   
(edited on: 2023-02-09 17:42)
Technical proposed solution:

org.openbravo.api.mappings.inventoryline.ImportInventoryLineJavaPropertyMappingHandler.setInventoryLineProduct():

In the query that gets the products:
1. Limit the query to return 1 record
2. Order the results by the inventory line organization's natural tree, i.e. to try to get first the product closest to the line's organization.
3. In the unlikely case of having the same searchkey at the same level in the parent tree and in the child tree (for example the same searchkey found in the immediate parent organization and in the immediate child organization), then take the one defined at the parent tree.

(0146391)
hgbot   
2023-02-10 15:00   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/128 [^]
(0146393)
hgbot   
2023-02-10 15:02   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api/-/merge_requests/12 [^]
(0146431)
hgbot   
2023-02-13 11:41   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api/-/merge_requests/12 [^]
(0146432)
hgbot   
2023-02-13 11:41   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api [^]
Changeset: 86142f0582c8946b4df3a8db3aece8bff96fbbe9
Author: Víctor Martínez Romanos <victor.martinez@openbravo.com>
Date: 10-02-2023 15:02:02
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.distributionorder.api/-/commit/86142f0582c8946b4df3a8db3aece8bff96fbbe9 [^]

Fixed ISSUE-51553: Product searchkey might not be unique, take closest one

---
M src/org/openbravo/distributionorder/api/mappings/distributionorderline/ImportDOLineJavaPropertyMappingHandler.java
---
(0146433)
hgbot   
2023-02-13 11:41   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.api [^]
Changeset: 4ffa39a621803fd0508539907e0261407ece584e
Author: Víctor Martínez Romanos <victor.martinez@openbravo.com>
Date: 10-02-2023 15:01:21
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/commit/4ffa39a621803fd0508539907e0261407ece584e [^]

Fixed ISSUE-51553: Product searchkey might not be unique, take closest one

Besides, removed useless order by in locator query

---
M src/org/openbravo/api/mappings/goodsmovementline/ImportGoodsMvmtLineJavaPropertyMappingHandler.java
M src/org/openbravo/api/mappings/inventoryline/ImportInventoryLineJavaPropertyMappingHandler.java
---
(0146434)
hgbot   
2023-02-13 11:41   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/128 [^]