Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0043750 | Openbravo ERP | 03. Procurement management | public | 2020-04-16 11:30 | 2020-04-16 12:22 |
Reporter | santi_lozano | ||||
Assigned To | Triage Omni OMS | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Merge Request Status | |||||
Review Assigned To | |||||
OBNetwork customer | |||||
Web browser | |||||
Modules | Core | ||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0043750: Exchanged values on variables QtyDelivered and QtyInvoiced at function c_order_post1 but without more affections | ||||
Description | The function c_order_post1 has a part in which it calculates the QtyDelivered and QtyInvoiced taking those values exchanged. This doesn't get further affection on code as it is only used to calculate the greatest value of both later. But maybe on further implementations of code this variables could be wrongly used. It is part of the code that calculates the difference between the ordered and received/delivered quantities and updates the m_storage_pending. Concretely the "if" part for purchase orders. | ||||
Steps To Reproduce | 1) Check how those variables are gotten COALESCE((SELECT SUM(CASE WHEN M_MATCHPO.M_INOUTLINE_ID IS NULL THEN M_MATCHPO.QTY ELSE 0 END) FROM M_MATCHPO WHERE M_MATCHPO.C_ORDERLINE_ID=C_ORDERLINE.C_ORDERLINE_ID), 0) AS QtyDelivered, COALESCE((SELECT SUM(CASE WHEN M_MATCHPO.C_INVOICELINE_ID IS NULL THEN M_MATCHPO.QTY ELSE 0 END) FROM M_MATCHPO WHERE M_MATCHPO.C_ORDERLINE_ID=C_ORDERLINE.C_ORDERLINE_ID), 0) AS QtyInvoiced 2) Check how those variables are used to calculate the higher amount of both later ->A: v_QtyOrdered := COALESCE(CASE WHEN (Cur_Inventory.QtyDelivered < 0) THEN LEAST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) ELSE CASE WHEN (Cur_Inventory.QtyDelivered = 0) THEN Cur_Inventory.QtyInvoiced ELSE GREATEST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) END END, 0); ->B: ELSE (COALESCE(c_uom_convert((CASE WHEN (Cur_Inventory.QtyDelivered < 0) THEN LEAST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) ELSE GREATEST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) END) 3) One can also check it functionally, create a purchase order, with two lines (example one qty=10 and other qty=5), create a goods receipt for one line and a purchase invoice for the other, then run the query on database of step 1 for the c_orderline_id (see attached images for a similar example) | ||||
Proposed Solution | Instead of "is null" use "is not null" on the first two select | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | 15574 - 001 .png (132,764) 2020-04-16 11:37 https://issues.openbravo.com/file_download.php?file_id=14319&type=bug 15574 - 002 .png (108,950) 2020-04-16 11:37 https://issues.openbravo.com/file_download.php?file_id=14320&type=bug 15574 - 003 .png (67,547) 2020-04-16 11:37 https://issues.openbravo.com/file_download.php?file_id=14321&type=bug 15574 - 004 .png (86,240) 2020-04-16 11:37 https://issues.openbravo.com/file_download.php?file_id=14322&type=bug | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2020-04-16 11:30 | santi_lozano | New Issue | |||
2020-04-16 11:30 | santi_lozano | Assigned To | => Triage Finance | ||
2020-04-16 11:30 | santi_lozano | Modules | => Core | ||
2020-04-16 11:30 | santi_lozano | Triggers an Emergency Pack | => No | ||
2020-04-16 11:35 | santi_lozano | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=20791#r20791 | ||
2020-04-16 11:37 | santi_lozano | File Added: 15574 - 001 .png | |||
2020-04-16 11:37 | santi_lozano | File Added: 15574 - 002 .png | |||
2020-04-16 11:37 | santi_lozano | File Added: 15574 - 003 .png | |||
2020-04-16 11:37 | santi_lozano | File Added: 15574 - 004 .png | |||
2020-04-16 11:39 | santi_lozano | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=20792#r20792 | ||
2020-04-16 12:22 | santi_lozano | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=20793#r20793 |
There are no notes attached to this issue. |