Openbravo Issue Tracking System - Retail Modules
View Issue Details
0049991Retail ModulesRetail APIpublic2022-08-12 07:262022-11-08 15:39
prakashmurugesan88 
prakashmurugesan88 
normalmajoralways
closedfixed 
5
 
 
No
0049991: Check Constraint(m_storage_detail_check1) violation when we try to integrate physical inventory by API for some products
In Physical Inventory API when trying to update a product(some products) quantity to '0'.

Inventory is not imported.
Following error appears in console:
ERROR: new row for relation "m_storage_detail" violates check constraint "m_storage_detail_check1"
In Physical Inventory API try to update a product quantity to '0'.

Prerequisite:
Product must has stock qty in that warehouse and bin.
Product must have entry M_STORAGE_DETAIL with QTYORDERONHAND, PREQTYORDERONHAND is not null.

Check Inventory is not imported.
Following error appears in console:
ERROR: new row for relation "m_storage_detail" violates check constraint "m_storage_detail_check1"

Detail: Failing row contains (ABAA38F137B64F0DA5E9B89BAB2821D9, C8F84269A01041ADB5E61ADCBDA575A8, 0, 100, null, 0, 0, 2022-07-29 00:00:00, 0, 0, FD0BE3FBD9BA4CDFB8523667F50DB389, B2C16DEF83824A98BB08E218E63EB798, Y, 2022-07-29 17:28:18, 100, 2022-07-29 17:28:18, 100, 62802F293E1A4DCE9013F7CB353905A8, 0, 0, null). Where: SQL statement
"INSERT INTO M_STORAGE_DETAIL ( M_Storage_Detail_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, M_PRODUCT_ID, M_LOCATOR_ID, M_ATTRIBUTESETINSTANCE_ID, C_UOM_ID, M_PRODUCT_UOM_ID, QTYONHAND, QTYORDERONHAND, DATELASTINVENTORY, PREQTYONHAND, PREQTYORDERONHAND, M_REFINVENTORY_ID ) VALUES ( get_uuid(), p_client, p_org, 'Y', TO_DATE(NOW()), p_user, TO_DATE(NOW()), p_user, p_product, p_locator, v_attributesetinstance, p_uom, p_product_uom, COALESCE(p_qty, 0), v_qtyorder, p_datelastinventory, COALESCE(p_preqty, 0), v_preqtyorder, v_refinventoryid )"
No tags attached.
related to defect 0050776 closed Triage Omni WMS Openbravo ERP Error in InventoryCountProcess - constraint "m_storage_detail_check1" violation 
related to defect 0050039 closed AtulOpenbravo Retail Modules Check Constraint(m_storage_detail_check1) violation when we try to integrate physical inventory by API for some products 
Issue History
2022-08-12 07:26prakashmurugesan88New Issue
2022-08-12 07:26prakashmurugesan88Assigned To => prakashmurugesan88
2022-08-12 07:26prakashmurugesan88Triggers an Emergency Pack => No
2022-08-12 07:26prakashmurugesan88Statusnew => scheduled
2022-08-12 07:36prakashmurugesan88Note Added: 0140079
2022-08-12 11:29hgbotResolutionopen => fixed
2022-08-12 11:29hgbotStatusscheduled => resolved
2022-08-12 11:29hgbotNote Added: 0140092
2022-08-12 11:30vmromanosStatusresolved => closed
2022-08-24 08:22vmromanosRelationship addedrelated to 0050039
2022-11-08 15:39rafarodaRelationship addedrelated to 0050776

Notes
(0140079)
prakashmurugesan88   
2022-08-12 07:36   
Merge Request Created,
https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/71 [^]
(0140092)
hgbot   
2022-08-12 11:29   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.api [^]
Changeset: 6d80d212e8b8d79f7779cd7fad6ee8ce5bc57874
Author: Prakash M <prakash@qualiantech.com>
Date: 12-08-2022 11:02:30
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/commit/6d80d212e8b8d79f7779cd7fad6ee8ce5bc57874 [^]

Fixed ISSUE-49991: Fixes m_storage_detail_check1 check constraint violation when the qty is updated to zero
* Issue occurs as book qty is not reflected in Inventory Line Object
* Hence BookQty and InventoryLineQty are 0, therefore M_UPDATE_INVENTORY is invoked
* Therefore trying to update order uom as null and constraint voilated
* Fixed by refreshing the Inventory Line Object

---
M src/org/openbravo/api/hook/inventory/ImportedInventoryBaseOBObjectAfterFlushHook.java
---