Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033752Openbravo ERP07. Sales managementpublic2016-08-19 14:162017-03-20 16:59
ngarcia 
markmm82 
immediatemajoralways
closedfixed 
5
 
3.0PR16Q4 
aferraz
Core
No
0033752: Cannot close an order if the stock was reserved and the associated goods shipment is voided
Cannot close an order if the stock was reserved and the associated goods shipment is voided

In 3.0PR15Q2.5 the order could be closed because instead of generating a new stock reservation the original one was updated

In 3.0PR15Q4.6 the order could be closed only when stock reservation was not set as automatic

As group admin role:
   1. Add the Enable Stock Reservations preference
   2. Log out and log in
   3. Create a Sales Order
   4. Add a product with stock in an on hand warehouse
   5. Book it
   6. Click on Manage Reservation button and reserve the stock (Allocated = 'N')
   7. Create the Goods Shipment by the Create Shipments From Orders process
   8. Check the Released quantity has been updated in the reservation
   9. Go to Goods Shipment window and void the previously created record
   10. Check a new reservation has been created for the sales order line
   11. Try to close the order and check the following error message is raised:
      "There is a sales order line with more than one open reservation"
   12. Repeat the 3-5 steps by selecting the Automatic Stock Reservation option at sales order line
   13. Repeat the 7-11 steps
No tags attached.
related to defect 0032390 closed markmm82 Cannot close an order with an allocated reservation if the released quantity is smaller than half the total reserved quantity 
related to defect 00317993.0PR16Q2 closed aferraz Cannot void a goods shipment if it has more than one closed reservation associated 
related to defect 00319023.0PR16Q2 closed aferraz Cannot void a goods shipment if it has related reservation and there is less stock than double of shipment quantity 
related to defect 00319563.0PR16Q2 closed aferraz Cannot void a goods shipment if it has related reservation under some circumstances 
related to defect 00320783.0PR16Q2 closed aferraz Reserved quantity is not correct under certain circumstances 
related to defect 0033879 closed markmm82 Close Reservation process fails 
related to defect 0033838 closed markmm82 Available inventory not correct if an order including a reserved product is closed. 
related to defect 00318763.0PR16Q2 closed aferraz Cannot void a goods shipment if two lines are related with the same sales order line which is reserved and released 
related to defect 0035270 closed collazoandy4 Wrong reservation when closing a sales order with a voided partial shipment 
blocks defect 0033837 closed markmm82 Reservation Status info is not correct if an order including a reserved product is closed. 
Issue History
2016-08-19 14:16ngarciaNew Issue
2016-08-19 14:16ngarciaAssigned To => Triage Finance
2016-08-19 14:16ngarciaModules => Core
2016-08-19 14:16ngarciaResolution time => 1473372000
2016-08-19 14:16ngarciaTriggers an Emergency Pack => No
2016-08-19 14:16ngarciaIssue Monitored: networkb
2016-08-19 14:17ngarciaPriorityurgent => immediate
2016-08-20 21:52aferrazRelationship addedrelated to 0032390
2016-08-20 21:53aferrazRelationship addedrelated to 0031799
2016-08-20 21:54aferrazRelationship addedrelated to 0031902
2016-08-20 21:54aferrazRelationship addedrelated to 0031956
2016-08-20 21:54aferrazRelationship addedrelated to 0032078
2016-08-22 13:39aferrazAssigned ToTriage Finance => markmm82
2016-08-22 17:26markmm82Statusnew => scheduled
2016-08-23 17:30markmm82Note Added: 0089315
2016-08-26 13:20psanjuanNote Added: 0089449
2016-08-26 14:28psanjuanNote Edited: 0089315bug_revision_view_page.php?bugnote_id=0089315#r12919
2016-08-29 11:58psanjuanRelationship addedrelated to 0033837
2016-08-29 11:58psanjuanRelationship addeddepends on 0033838
2016-08-30 09:47psanjuanNote Added: 0089528
2016-08-30 09:48psanjuanRelationship addedrelated to 0033842
2016-09-05 13:28aferrazRelationship addedrelated to 0033879
2016-09-05 15:54markmm82Note Added: 0089759
2016-09-05 18:05aferrazRelationship deleteddepends on 0033838
2016-09-05 18:05aferrazRelationship addedrelated to 0033838
2016-09-05 18:21aferrazRelationship deletedrelated to 0033837
2016-09-05 18:22aferrazRelationship addedblocks 0033837
2016-09-05 19:23aferrazRelationship addedrelated to 0031876
2016-09-06 10:14psanjuanNote Edited: 0089315bug_revision_view_page.php?bugnote_id=0089315#r13057
2016-09-06 10:31psanjuanNote Edited: 0089315bug_revision_view_page.php?bugnote_id=0089315#r13060
2016-09-06 11:10psanjuanNote Edited: 0089759bug_revision_view_page.php?bugnote_id=0089759#r13062
2016-09-06 11:14psanjuanNote Edited: 0089759bug_revision_view_page.php?bugnote_id=0089759#r13063
2016-09-06 11:15psanjuanNote Added: 0089776
2016-09-06 16:53markmm82Note Added: 0089786
2016-09-07 14:45hgbotCheckin
2016-09-07 14:45hgbotNote Added: 0089806
2016-09-07 14:45hgbotStatusscheduled => resolved
2016-09-07 14:45hgbotResolutionopen => fixed
2016-09-07 14:45hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/3886c94b14d9be96bb43e1f7c6771f9866ee5513 [^]
2016-09-07 14:46aferrazReview Assigned To => aferraz
2016-09-07 14:46aferrazNote Added: 0089807
2016-09-07 14:46aferrazStatusresolved => closed
2016-09-07 14:46aferrazFixed in Version => 3.0PR16Q4
2016-09-07 19:58hudsonbotCheckin
2016-09-07 19:58hudsonbotNote Added: 0089816
2017-01-31 14:01eugeniIssue Monitored: eugeni
2017-03-20 16:59jfrancesIssue Monitored: jfrances
2017-03-23 09:33aferrazRelationship addedrelated to 0035270

Notes
(0089315)
markmm82   
2016-08-23 17:30   
(edited on: 2016-09-06 10:31)
As group admin role:
   - Add the Enable Stock Reservations preference
   - Log out and log in

Test Plan 1
   1. Create a Sales Order for a quantity = 10
   2. Add a product with stock in an on hand warehouse (Available stock = 100 units in storage bin RN-1-0-0, for instance).
   3. Book it
   4. Click on Manage Reservation button and reserve the stock (Allocated = 'N')
   5. Create the Goods Shipment by the Create Shipments From Orders process
   6. Check the Released quantity has been updated in the reservation
   7. Go to Goods Shipment window and void the previously created record
   8. Check a new reservation has been created for the sales order line
   9. Try to close the order and check no error message is raised and the order is closed.

Test Plan 2
   Repeat the 1-3 steps by selecting the Automatic Stock Reservation option at sales order line
   Repeat the 5-9 steps. Notice you are able to close the order.

Test Plan 3
   Repeat the 1-3 steps by selecting the Manual Stock Reservation option at sales order line
   Repeat the 5-9 steps. Notice you are able to close the order.

Check that the sales order can be closed without any problem and the new created reservation, changes as below:
Quantity = Reserved Qty = Released = 0 units.
Status = Completed

If you try now to reserve same product, available qty = 100

Test Plan 4

Repeat same test as above for a product having stock in two different storage bins. Create a sales order for 2 units, reserve 1 unit from each storage bin, manually create the shipment. Check reservation is updated as Closed, Released quantity = 2. Void the shipment. Check a new reservation is created.

Check that the sales order can be closed without any problem and the new created reservation, changes as below:
Quantity = Reserved Qty = Released = 0 units.
Status = Completed

-----

Test Plan 5 (related issue 31799)
- Create a Sales Order, add two products with stock and Isquantityvariable = 'N'. Book it.
  Realize header and lines reservation status is "Not Reserved".

- Select first line and create a reservation with the same quantity as ordered quantity.
  Realize line reservation status is set to "Completely Reserved".
  Realize header reservation status is set to "Partially Reserved".

- Select second line and create a reservation with the same quantity as ordered quantity.
  Realize line reservation status is set to "Completely Reserved".
  Realize header reservation status is set to "Completely Reserved".

- Check in Stock Reservation window, two related reservations are created with "Completed" status.

- Go to Goods Shipment window, create a header and select the previously created sales order lines. Complete it.
  Realize sales order header and lines reservation status is still "Completely Reserved".

- Check in Stock Reservation window, two related reservations are updated to "Closed" status.

- Void created Goods Shipment.
  Check process finishes successfully.
  Realize sales order header and lines reservation status is still "Completely Reserved".

- Check in Stock Reservation window, two new reservations are created, related to the same sales order lines as previous ones, with "Completed" status.

Test Plan 6 (related issue 31799)
- Create a Sales Order for "Alimentos y Supermercados, S.A" business partner. Add a line with a product with stock and Isquantityvariable = 'Y'. Book it.
  Realize header and line reservation status is "Not Reserved".
  Realize a second line with "Descuento 10%" product is added.

- Add a reservation for the first line with less quantity as ordered quantity.
  Realize both header and line reservation status is set to "Partially Reserved".

- Update reservation with same quantity as ordered quantity.
  Realize both header and line reservation status is set to "Completely Reserved".

- Update reservation with more quantity as ordered quantity.
  Realize both header and line reservation status is set to "Completely Reserved".

-----

Test Plan 7 (related issue 32390)
- Create three sales orders of 10 units
- Reserve the 10 units of the three orders and set the reservations as allocated
- Create a goods shipment with 2, 5 and 8 units of each sales order respectively
- Try to close any of previous sales orders (with 2,5,8 units released) and check the following error message is shown:
   "There is more allocated quantity than ordered quantity"

Test Plan 6 (related issue 32390)
- Create a product named "Test A" in F&B España.
- Relate it to a purchase price list (Tarifa Bebidas Alegres) and a sales price list (Tarifa de Ventas).
- Create a goods receipt of 40 units.
- Create a sales orders of 10 units
- Reserve the 10 units as allocated
- Create a goods shipment for 2 units by using "Create Lines From" process
- After that try to close the sales order.
- Check the following error message is shown, which is correct:
   "There is more allocated quantity than ordered quantity"

   Either:
   - Set allocated quantity to 2, same as released quantity by using "Manage Reservation" button
   - or remove allocated check by using "Manage Reservation" button
   Press Done.
   Close the order
   
Repeat same steps as above but creating each a sales order for 10 units but shipping 5, 8 and 10 units, each time.
In the case of shipping 10 units, there is not need to execute any further action but to close the order, as the full order is shipped.

-----

Test Plan 8 (related issue 31902)
- Create a product for F&B España and add a price list for "Tarifa de Bebidas Alegres" and "Tarifa de ventas" .
- Create a receipt for created product, qty=29 in RN-0-0-0 locator.
- Create a sales order, add the previously created product and qty=15. Complete it.
- Add a complete reservation to it (qty=15 in RN-0-0-0).
- Realize a stock reservation has been created with qty=15, reserved qty=15, released=0 and a line with qty=15 released=0 in RN-0-0-0.
- Create a shipment from sales order with qty=15 in RN-0-0-0. Complete it.
- Realize stock reservation has been closed with qty=15, reserved qty=15, released=15 and line with qty=15 released=15 in RN-0-0-0.
- Void shipment.
- Realize a new stock reservation has been created in completed status with qty=15, reserved qty=15, released=0 and line with qty=15 released=0 in RN-0-0-0.

Test Plan 9 (related issue 31902)
- Create a product named "31902 I" for F&B España and add a price list for "Tarifa de Bebidas Alegres" and "Tarifa de ventas".
- Create another product named "31902 II" for F&B España and add a price list for "Tarifa de Bebidas Alegres" and "Tarifa de ventas".
- Create a purchase order for F&B España with below data:
    Product "31902 I", qty ordered = 40
    Product "31902 II", qty ordered = 60
    Book the order.

- Create a receipt for created products:
    Product "31902 I", qty received = 15 in RN-0-0-0
    Product "31902 II", qty received = 20 in RN-1-0-0
    Book the receipt.

- Create a sales order, add the previously created products:
    Product "31902 I", qty ordered = 15
    Product "31902 II", qty ordered = 20

- Add a complete reservation of each line
    Product "31902 I", qty reserved = 15 in RN-0-0-0
    Product "31902 II", qty reserved = 20 in RN-1-0-0

- Check that two stock reservations, one for each product, have been created:
    For the first product "31902 I", qty= 15, Reserved Qty=15, Released = 0
    For the second product "31902 II", qty=20, Reserved Qty=20, Released = 0

- Create a shipment from sales order for both products, full quantity each. Complete it.

- Check that stock reservations have changed its status to "Closed" with below data:
    For the first product "31902 I", qty= 15, Reserved Qty=15, Released = 15
    For the second product "31902 II", qty=20, Reserved Qty=20, Released = 20

- Void shipment.

- Check that two new stock reservations have been created in status "Completed" with below data:
    For the first product "31902 I", qty= 15, Reserved Qty=15, Released = 0
    For the second product "31902 II", qty=20, Reserved Qty=20, Released = 0


Test Plan 10 (related issue 31902)
- Repeat Test Plan 8 above until
- Create a shipment from sales order for both products, but this time do not ship the full quantity but part of it, therefore:
    Product "31902 I", qty shipped = 5 from RN-0-0-0
    Product "31902 II", qty shipped = 10 from RN-1-0-0

- Check that the two stock reservations have been updated therefore release qty shown is no longer 0 units but the corresponding qty (5 and 10)

- Create a new shipment for part of qty:
    Product "31902 I", qty shipped = 7 from RN-0-0-0
    Product "31902 II", qty shipped = 3f rom RN-1-0-0
    Complete it.

- Check that stock reservations have been updated therefore release qty shown now is (5+7=12 and 10+3=13)

- Void second shipment, no error is shown.

- Check that stock reservation is still on "Completed" status and released qty is now back to 5 and 10


Test Plan 11 (related issue 31902)
- Repeat test plan 9 until

- Create a new shipment for part of qty, but this time ship all remaining quantity.
    Product "31902 I", qty shipped = 10 from RN-0-0-0
    Product "31902 II", qty shipped = 10 from RN-1-0-0
    Complete it.

- Check that stock reservations have been updated therefore release qty shown is (5+10= 15 and 10+10= 20); full quantity of the sales order. Check also that the status of the stock reservation is now "Closed"

- Void second shipment

- Check that two new stock reservations have been created in status "Completed" with below information:
    Stock Reservation 1 for Product "31902 I", qty= 15, reserved qty= 10, released=0
    Stock Reservation 2 for Product "31902 II", qty= 20, reserved qty= 10, released=0

------

Test Plan 12 (related issue 31956)
- Create a product for España and add a price list for "Tarifa de Bebidas Alegres" and "Tarifa de ventas" .
- Create a receipt for created product, qty=25 in RN-0-0-0 locator.
- Create another receipt for created product, qty= 25 in RN-1-0-0 locator.
- Create a sales order, add the previously created product and qty=50. Complete it.
- Add a complete reservation to it (qty=25 in RN-0-0-0 and qty = 25 in RN-1-0-0).
- Realize a stock reservation has been created with qty=50, reserved qty=50, released=0 and two lines one per each locator with qty=25 released=0
- Create a shipment from sales order with two lines one per each locator, qty=25 each. Complete it.
- Realize stock reservation has been closed with qty=50, reserved qty=50, released=50 and two lines one per each locator with qty=25 released=25
- Void the shipment.
- Realize a new stock reservation has been created in completed status with qty=50, reserved qty=50, released=0 and two lines one per each locator with qty=25 released=0


Test Plan 13 (related issue 31956)
- Create a product for España and add a price list for "Tarifa de Bebidas Alegres" and "Tarifa de ventas" .
- Create a receipt for created product, qty=25 in RN-0-0-0 locator.
- Create another receipt for created product, qty= 25 in RN-1-0-0 locator.
- Create a sales order, add the previously created product and qty=50. Complete it.
- Add a complete reservation to it (qty=25 in RN-0-0-0 and qty = 25 in RN-1-0-0).
- Realize a stock reservation has been created with qty=50, reserved qty=50, released=0 and two lines one per each locator with qty=25 released=0
- Create a shipment from sales order with two lines:
     Qty = 20 from RN-0-0-0
     Qty = 20 from Rn-1-0-0
     Complete it.

- Check that the stock reservation has been updated with qty=50, reserved qty=50, released=40 and two lines one per each locator with qty=25 released=20

- Create another shipment from sales order with two lines:
     Qty = 5 from RN-0-0-0
     Qty = 5 from Rn-1-0-0
   Complete it.

- Check that the stock reservation has been updated to Closed with qty=50, reserved qty=50, released=50 and two lines one per each locator with qty=25 released=25

   Void the second shipment.

   Realize a new stock reservation has been created in completed status with qty=50, reserved qty=10, released=0 and two lines one per each locator with qty=5 released=0

-----


Test Plan 14 (related issue 32078)
- Create a product for España named "32078 A"
- Add a price list for "Tarifa de Bebidas Alegres" and "Tarifa de ventas" .
- Create a receipt for created product with qty=10 in RN-0-0-0 locator.
- Create a sales order, add the previously created product and qty=10. Complete it.

- Add a reservation to it of qty=7 in RN-0-0-0.
    Realize a stock reservation has been created with qty=10, reserved qty=7, released=0 and a line with qty=7 released=0 in RN-0-0-0.

- Create another receipt for the same product. This time received 100 units in the storage bin RN-1-0-0. Complete it.
- Create a sales order, add previously created product and qty = 50. Complete it.
- Add reservation to it of qty=50 from RN-1-0-0.
    Realize that a new stock reservation has been created with qty = 50, Reserved qty= 50

Test Plan 15 (related issue 32078)
- Create a product for España named "32078 B"
- Add a price list for "Tarifa de Bebidas Alegres" and "Tarifa de ventas".
- Create a Purchase Order for that product and qty=10. Book it.
- Create a Sales Order for the same product and qty=10. Book it.
- Go to the line, click on Manage Reservation button and select the purchase order line and enter 10 in the column Quantity.
- Realize a stock reservation has been created with qty=10, reserved qty=10, released=0 and a line related with purchase order line with qty=10 and released=0.

- Create another Purchase Order for that product and qty=100. Book it.
- Create a Sales Order for the same product and qty=90. Book it.
- Go to the line, click on Manage Reservation button and select the purchase order line and enter 50 in the column Quantity.
- Realize a stock reservation has been created with qty=90, reserved qty=50, released=0.

- Create a Goods Receipt from the purchase order, receipt all 100 units in storage bin RN-1-0-0.Complete it.

- Create a Goods Shipment from the sales order, to ship 90 units from the storage bin RN-1-0-0. Complete it.

- Go to the Stock reservation and verify it has changed as below:
   - Quantity = 90
   - Reserved Qty = 90
   - Released = 90

(0089449)
psanjuan   
2016-08-26 13:20   
Issue verified.
(0089528)
psanjuan   
2016-08-30 09:47   
Test Plan above verified.
Issue can be code reviewed and closed.
(0089759)
markmm82   
2016-09-05 15:54   
(edited on: 2016-09-06 11:14)
Test Plan 16 for related issue 33842
  Make sure that "Enable Stock Reservations" preference is active as "Y".
  Log out and log in.

  In F&B International group create a new product named 33842
  Relate it to a purchase and a sales price list ().

  Go to purchase order and create a new order for F&B España and Bebidas Alegres BP. Enter 10 units of the product. Book the order.
  Create a goods receipt, and receipt the 10 units in RN-0-0-0 storage bin. Complete the receipt.
  Go to Sales order and create a new one for 2 units of the product. Select "Automatic" in Stock Reservation field. Book the order.

  Check that a new stock reservation has been created automatically with below data:
    Quantity = 2 = Reserved Qty = 2
    Released = 0

  Go to Goods Shipment window and ship that 2 units from RN-0-0-0 bin. Complete the shipment.

  Check that a stock reservation shows now below data and status "Closed".
    Quantity = 2 = Reserved Qty = 2 = Released = 2

  Go back to the order and try to close it. Notice the order can be closed successfully.

(0089776)
psanjuan   
2016-09-06 11:15   
Verified once again and after a second fix Test Cases 1, 2, 3, 4 and 16 above.
(0089786)
markmm82   
2016-09-06 16:53   
Verified once again and after a second fix Test Cases from 5 to 15 above.
(0089806)
hgbot   
2016-09-07 14:45   
Repository: erp/devel/pi
Changeset: 3886c94b14d9be96bb43e1f7c6771f9866ee5513
Author: Mark <markmm82 <at> gmail.com>
Date: Fri Sep 02 12:10:01 2016 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/3886c94b14d9be96bb43e1f7c6771f9866ee5513 [^]

Fixes issue 33752: Can be closed an order with reserved stock

If the stock was reserved and the associated goods shipment voided, the order was raising an error when trying to close it.
When reservations are retrieved, C_ORDER_POST1 trigger doesn't takes into account the status of previously released reservations.
To make this validation works homogeneously just like is now in other areas where this validation is executed (C_ORDER_POST1, M_INOUT_CREATE, M_INOUT_POST, M_RESERVATION_POST) the query that retrieves the count of reservations of the line also takes into account those lines with status different than 'CL'.
Also validates that is created a new reservation for the line only if doesn't exists any reservation for it.

---
M src-db/database/model/functions/C_ORDER_POST1.xml
---
(0089807)
aferraz   
2016-09-07 14:46   
Code review OK
(0089816)
hudsonbot   
2016-09-07 19:58   
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/97008b02fc55 [^]
Maturity status: Test