Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0043750
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 03. Procurement managementminoralways2020-04-16 11:302020-04-16 12:22
Reportersanti_lozanoView Statuspublic 
Assigned ToTriage Omni OMS 
PrioritynormalResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0043750: Exchanged values on variables QtyDelivered and QtyInvoiced at function c_order_post1 but without more affections

DescriptionThe 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 Reproduce1) 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 SolutionInstead of "is null" use "is not null" on the first two select
TagsNo tags attached.
Attached Filespng file icon 15574 - 001 .png [^] (132,764 bytes) 2020-04-16 11:37


png file icon 15574 - 002 .png [^] (108,950 bytes) 2020-04-16 11:37


png file icon 15574 - 003 .png [^] (67,547 bytes) 2020-04-16 11:37


png file icon 15574 - 004 .png [^] (86,240 bytes) 2020-04-16 11:37

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
There are no notes attached to this issue.

- 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
Powered by Mantis Bugtracker