Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
ID | ||||||||||||
0043750 | ||||||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
defect | [Openbravo ERP] 03. Procurement management | minor | always | 2020-04-16 11:30 | 2020-04-16 12:22 | |||||||
Reporter | santi_lozano | View Status | public | |||||||||
Assigned To | Triage Omni OMS | |||||||||||
Priority | normal | Resolution | open | Fixed in Version | ||||||||
Status | new | Fix in branch | Fixed in SCM revision | |||||||||
Projection | none | ETA | none | Target Version | ||||||||
OS | Any | Database | Any | Java version | ||||||||
OS Version | Database version | Ant version | ||||||||||
Product Version | SCM revision | |||||||||||
Review Assigned To | ||||||||||||
Web browser | ||||||||||||
Modules | Core | |||||||||||
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 | |||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | 15574 - 001 .png [^] (132,764 bytes) 2020-04-16 11:37
15574 - 002 .png [^] (108,950 bytes) 2020-04-16 11:37 15574 - 003 .png [^] (67,547 bytes) 2020-04-16 11:37 15574 - 004 .png [^] (86,240 bytes) 2020-04-16 11:37 | |||||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | |
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 | View Revisions |
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 | View Revisions |
2020-04-16 12:22 | santi_lozano | Steps to Reproduce Updated | View Revisions |
Copyright © 2000 - 2009 MantisBT Group |