Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028051Openbravo ERP04. Warehouse managementpublic2014-11-03 08:372015-03-25 13:18
VictorVillar 
umartirena 
urgentmajoralways
closedfixed 
5
pi 
3.0PR15Q2 
vmromanos
Core
No
0028051: Reserved quantity is not correct under certain circumstancies
Reserved quantity is not correct under certain circumstancies.

Also, the behavior in Oracle differs from Postgres. In Oracle when opening Manage Stock P&E, it automatically creates and processes the reservation, even if the Done button is not clicked. This happens because in Oracle M_RESERVATION_POST stored procedure automatically commits against database, unlike in Postgres.
Reservations are disabled by default. To be able to use them please insert a new Preference using property Enable Stock Reservations with value Y.
http://wiki.openbravo.com/wiki/Stock_Reservation [^]

As group Admin role,
Go to Physical inventory and remove the stock for Cerveza Lager. Keep 700 units in Warehouse España Región Norte 0-0-0
Go to Sales Order window,
  Org: España
Lines:
 Cerveza Lager: qty: 900
 Stock Reservation: blank
Book it.
Once you select the line, you will see Manage Reservations button. Click on it, and indicate you would like to reserve 400 units. Click on Done.

Go to Stock reservation window.
Realize that the register created indicates 700 units, but the user said 400. That is wrong.

If you manage Stock again from the Stock Reservation window, and you indicate 400, now the register has the correct qty.

Also, test the following flow in Oracle:

Create a Sales Order with a line. Click on that line and press Manage Reservations.
 * Click on Cancel.
 * Go to Linked Items of that line and realize that a reservation has been created. This is wrong because we've selected cancel in the P&E. This happens because M_RESERVATION_POST commits, as explained in the description above.
No tags attached.
related to defect 0029218 closed eduardo_Argal Cannot save a Stock Reservation in PostgreSQL 8.4 
related to defect 00280523.0PR15Q2 closed umartirena Wrong error message processing a Goods Shipment if you have a partial reservation 
related to defect 00285103.0PR15Q2 closed reinaldoguerra Manage Reservation P&E behavior could be confusing in some cases opened from Sales Order Line 
related to defect 00320783.0PR16Q2 closed aferraz Reserved quantity is not correct under certain circumstances 
related to defect 0032089 closed aferraz Product with stock in second UOM is automatically reserved but it is not possible to reserve it manually 
Issue History
2014-11-03 08:37VictorVillarNew Issue
2014-11-03 08:37VictorVillarAssigned To => dmiguelez
2014-11-03 08:37VictorVillarModules => Core
2014-11-03 08:37VictorVillarResolution time => 1417647600
2014-11-03 08:37VictorVillarTriggers an Emergency Pack => No
2014-11-03 11:13VictorVillarTarget Version => 3.0PR15Q1
2014-11-03 11:22VictorVillarRelationship addedrelated to 0028052
2014-12-13 20:32reinaldoguerraAssigned Todmiguelez => reinaldoguerra
2014-12-13 20:32reinaldoguerraStatusnew => scheduled
2014-12-22 16:17reinaldoguerraNote Added: 0072773
2014-12-30 10:42umartirenaTypedefect => design defect
2014-12-30 10:42umartirenaTarget Version3.0PR15Q1 =>
2014-12-30 10:47umartirenaNote Added: 0072873
2014-12-31 16:30umartirenaRelationship addedrelated to 0028510
2015-02-26 18:45umartirenaNote Added: 0074992
2015-02-26 18:54umartirenaDescription Updatedbug_revision_view_page.php?rev_id=7796#r7796
2015-02-26 18:54umartirenaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7798#r7798
2015-02-26 19:21umartirenaAssigned Toreinaldoguerra => umartirena
2015-02-26 19:22umartirenaTarget Version => 3.0PR15Q2
2015-02-27 08:17hgbotCheckin
2015-02-27 08:17hgbotNote Added: 0075008
2015-02-27 08:17hgbotStatusscheduled => resolved
2015-02-27 08:17hgbotResolutionopen => fixed
2015-02-27 08:17hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/b6c2ecaf7e1a8026f737b28649e3a61c6b450d59 [^]
2015-02-27 16:11hudsonbotCheckin
2015-02-27 16:11hudsonbotNote Added: 0075051
2015-03-13 10:34dmitry_mezentsevNote Added: 0075523
2015-03-25 13:17vmromanosRelationship addedrelated to 0029218
2015-03-25 13:18vmromanosReview Assigned To => vmromanos
2015-03-25 13:18vmromanosNote Added: 0075967
2015-03-25 13:18vmromanosStatusresolved => closed
2016-02-01 17:14aferrazRelationship addedrelated to 0032078
2016-02-05 11:41aferrazRelationship addedrelated to 0032089
2018-07-19 11:53AtulOpenbravoNote Edited: 0072773bug_revision_view_page.php?bugnote_id=0072773#r17434

Notes
(0072773)
reinaldoguerra   
2014-12-22 16:17   
(edited on: 2018-07-19 11:53)
Test plan used:
1- Login into Openbravo ERP
2- Go to Preference window and and check that a new preference with property "Enable Stock Reservations" is created, if not then create a new record selecting Enable Stock Reservations property and setting Y as value.
3- Go to Product window and create a new one, organization España S.A
4- Go to price tab and and prices for Tarifa bebidas alegres and Tarifa de ventas price list versions
5- Go to Physical inventory window and register a new header for España Región Norte organization
6- Go to lines tab and add the created product. Select Rn-0-0-0 as Storage Bin and enter 700 as Quantity Count
7- Go to Sales Order window, create a new header also for for España Región Norte organization
8- Add a new line with created product, qty 900 and Stock Reservation: blank
9- Book it.
10- Once you select the line, you will see Manage Reservations button. Click on it, and indicate you would like to reserve 400 units. Click on Done.
11- Go to Stock reservation window.
12- Realise that the register created indicates Quantity = 900 Units and Reserved Qty = 400 units.

(0072873)
umartirena   
2014-12-30 10:47   
After talking with Gorka, this is the intended behavior when a reservation is being processed (try to reserve as much as possible). The issue has been changed to design defect because in this concrete case the way it works could be confusing for the user, so something should be redesigned (hide be Pick%Edit button in OrderLines when the reservation is not processed, give a warning...)
(0074992)
umartirena   
2015-02-26 18:45   
Finally the original issue is going to be fixed. The manage reservation process will reserve what the user specifies in the Pick & Execute. So, the related issue https://issues.openbravo.com/view.php?id=28510 [^] is going to be rejected.
(0075008)
hgbot   
2015-02-27 08:17   
Repository: erp/devel/pi
Changeset: b6c2ecaf7e1a8026f737b28649e3a61c6b450d59
Author: Unai Martirena <unai.martirena <at> openbravo.com>
Date: Thu Feb 26 19:48:36 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/b6c2ecaf7e1a8026f737b28649e3a61c6b450d59 [^]

Fixes bug 28051: Reserved qty now is correct.

In this issue 3 changes have been done:
[1]: In M_RESERVATION_POST stored procedure, when calling to AD_UPDATE_PINSTANCE an extra parameter has been added ('N'). This has been done to avoid to do a commit when working with Oracle database, because it was causing to behave different in Postgres and Oracle.
[2]: In StockReservationPickAndEditDataSource, when opening Manage Reservations P&E from Sales Order, it retrieves a Reservation related to the Order Line if it exists and it processes. This was failing in Oracle if it was already processed, so a check has been added to avoid this case.
[3]: In ManageReservationActionHandler, when clicking Done in Manage Reservation P&E, it was first reserving what the user was typing in the P&E, and if it was not processed the reservation, it was processing it. As the M_RESERVATION_POST tries always to reserve as much as possible, it was overriding the previously set amounts. In order to prevent this, now first the reservation is being processed and after that the values typed in the UI are being set to the reservation.

---
M src-db/database/model/functions/M_RESERVATION_POST.xml
M src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java
M src/org/openbravo/common/datasource/StockReservationPickAndEditDataSource.java
---
(0075051)
hudsonbot   
2015-02-27 16:11   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7f9c56fa7aba [^]
Maturity status: Test
(0075523)
dmitry_mezentsev   
2015-03-13 10:34   
The following issue is resolved but not yet closed for 14 days.
(0075967)
vmromanos   
2015-03-25 13:18   
Code review + testing OK