Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0010856Openbravo ERP07. Sales managementpublic2009-10-02 18:122024-07-08 14:52
networkb 
rafaroda 
immediatemajoralways
closedfixed 
5
2.35MP14 
2.35MP162.40MP12 
Core
No
0010856: Generate Invoices process with reactivated orders
You have an order with a line with qtyordered=5. Then you create a shipment and then an invoice by running Generate Invoices process. It creates an invoice with line quantity=5. (So now qtyinvoiced in c_orderline is 5).
The you void the shipment, reactivate the order and modify line quantity to 4. Complete the order and create the new shipment (with quantity=4). When running generate invoices it creates an invoice with quantity=4.
Then if you go to c_orderline qtyinvoiced=9 and qtyordered=4.

1. Sales Management || Transactions || Sales Order: create a sales order with at least one line with any qtyordered, and complete it.
2. Sales Management || Transactions || Goods Shipment: create a shipment for the order.
3. Run generate invoices and check that it creates an invoice for the qtyordered.
4. Sales Management || Transactions || Goods Shipment: void the shipment.
5. Sales Management || Transactions || Sales Order: reactivate the order and modify line qtyordered.
6. Sales Management || Transactions || Goods Shipment: create a shipment for the order.
7. Run generate invoices and check that it creates an invoice for the new qtyordered.
8. Sales Management || Transactions || Sales Order || Line: check that qtyinvoices is bigger that qtyordered.
No tags attached.
blocks defect 00108452.35MP16 closed rafaroda Generate Invoices process with reactivated orders 
Issue History
2009-10-05 08:54rafarodaTypedefect => backport
2009-10-05 08:54rafarodafix_in_branch => 2.40
2009-10-05 08:55rafarodaNote Added: 0020692
2009-10-19 11:39rafarodaAssigned Torafaroda => gorkaion
2009-11-05 10:23hgbotCheckin
2009-11-05 10:23hgbotNote Added: 0021587
2009-11-05 10:23hgbotStatusscheduled => resolved
2009-11-05 10:23hgbotResolutionopen => fixed
2009-11-05 10:23hgbotFixed in SCM revision => http://code.openbravo.com/erp/stable/2.40/rev/385327e1c5f0f6edeedd3cec40881dd726e4e218 [^]
2009-11-09 11:35sureshbabuStatusresolved => closed
2009-11-09 11:35sureshbabuNote Added: 0021646
2009-11-09 11:35sureshbabuFixed in Version => 2.50MP11
2009-11-25 10:31rafarodaAssigned Togorkaion => rafaroda
2009-11-25 10:31rafarodaNote Added: 0022162
2009-11-25 10:31rafarodaStatusclosed => new
2009-11-25 10:31rafarodaResolutionfixed => open
2009-11-25 10:31rafarodaFixed in Version2.50MP11 =>
2009-11-25 10:31rafarodaPriorityurgent => immediate
2009-11-25 10:31rafarodaStatusnew => scheduled
2009-11-26 15:38hgbotCheckin
2009-11-26 15:38hgbotNote Added: 0022185
2009-11-26 15:38hgbotStatusscheduled => resolved
2009-11-26 15:38hgbotResolutionopen => fixed
2009-11-26 15:38hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/stable/2.40/rev/385327e1c5f0f6edeedd3cec40881dd726e4e218 [^] => http://code.openbravo.com/erp/stable/2.40/rev/1ce95e2e705653d345c5054beb04ad704509416f [^]
2009-11-26 15:38rafarodaNote Added: 0022186
2009-12-08 07:48sureshbabuNote Added: 0022525
2009-12-08 07:48sureshbabuStatusresolved => closed
2009-12-08 07:48sureshbabuFixed in Version => 2.40MP12
2024-07-02 17:07hgbotNote Added: 0166618
2024-07-08 14:52hgbotNote Added: 0166804

Notes
(0020692)
rafaroda   
2009-10-05 08:55   
With this flow, starting with quantity 10, after reactivating and setting the order line to 12, it finishes as:
* Order Quantity = 12
* Delivered Quantity = 12
* Reserved Quantity = 0
* Invoiced Quantity = 22 (previous to reactivating is was 10)

Following the flow with Invoice Terms = Immediate, skipping the shipment steps and setting the order line to 12, it finishes as:
* Order Quantity = 12
* Delivered Quantity = 0
* Reserved Quantity = 12
* Invoiced Quantity = 12 (which is correct)
(0021587)
hgbot   
2009-11-05 10:23   
Repository: erp/stable/2.40
Changeset: 385327e1c5f0f6edeedd3cec40881dd726e4e218
Author: Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
Date: Thu Nov 05 10:22:13 2009 +0100
URL: http://code.openbravo.com/erp/stable/2.40/rev/385327e1c5f0f6edeedd3cec40881dd726e4e218 [^]

Fixed issue 10856.Added new restrictions to sales documents.
-Not possible to modify a draft sales order line with delivered or invoiced
qty.
-Not possible to void a shipment with invoiced qty for a sales order with
invoice rule after delivery.
-Not possible to complete an sales invoice if new invoiced qty will be higher
than ordered qty.
-Not possible to have a sales order line with invoiced qty higher than ordered
qty.

---
M src-db/database/model/functions/C_INVOICE_POST.xml
M src-db/database/model/functions/M_INOUT_POST.xml
M src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
M src-db/database/sourcedata/AD_MESSAGE_TRL.xml
---
(0021646)
sureshbabu   
2009-11-09 11:35   
Retested working fine, all the proposed restrictions are working fine

-Not possible to modify a draft sales order line with delivered or invoiced
qty.
-Not possible to void a shipment with invoiced qty for a sales order with
invoice rule after delivery.
-Not possible to complete an sales invoice if new invoiced qty will be higher
than ordered qty.
-Not possible to have a sales order line with invoiced qty higher than ordered
qty.
(0022162)
rafaroda   
2009-11-25 10:31   
We have find out that the solution is not working properly with negative quantities.
For example, in this scenario:
 * An order with qtyordered= -2
 * You have the shipment with qty= -2
 * You have the invoice with qtyinvoiced= -2
If you try to Reactivate the invoice is not possible because trigger C_ORDLINE_CHK_RESTRICTIONS_TRG.xml finds that qtyinvoiced > qtyordered (0 > -2)

Also it is necessary to show order documentno in the error, because when GenerateInvoices process fails the error raised says invoice documentno but as the invoice is not finally created you don't know which order gives you the error.
(0022185)
hgbot   
2009-11-26 15:38   
Repository: erp/stable/2.40
Changeset: 1ce95e2e705653d345c5054beb04ad704509416f
Author: Rafa Roda Palacios <rafael.roda <at> openbravo.com>
Date: Wed Nov 25 11:27:00 2009 +0100
URL: http://code.openbravo.com/erp/stable/2.40/rev/1ce95e2e705653d345c5054beb04ad704509416f [^]

Fixes issue 10856 Now caring negative orders cycle.

---
M src-db/database/model/functions/C_INVOICE_POST.xml
M src-db/database/model/functions/M_INOUT_POST.xml
M src-db/database/model/triggers/C_ORDLINE_CHK_RESTRICTIONS_TRG.xml
---
(0022186)
rafaroda   
2009-11-26 15:38   
SALES ORDER WITH POSITIVE QUANTITIES

1) Create a Sales Order Sales Management || Transactions || Sales Order
* Transaction Document = Warehouse Order
* Invoice Terms = After Delivery
2) Navigate to Lines tab and create a new record:
* Product = Hammer
* Ordered Quantity = 2
3) Navigate back to Header and Complete the Sales Order: a new Shipment is automatically created.
4) Navigate to Generate Invoices process Sales Management || Transactions || Generate Invoices
5) Select the former Sales Order and click on OK: a new Sales Invoice is created automatically.
6) Navigate to the Sales Order line and check that:
* Order Quantity = 2
* Delivered Quantity = 2
* Invoiced Quantity = 2
7) Navigate to the Goods Shipment created, click on Close button and select Void: Shipment No. : xxxx line : 10. It is not possible to void a shipment of an order that has an invoice rule after delivery having invoiced lines. CORRECT
8) Navigate to the Sales Invoice created, click on Reactivate button and select Reactivate: Sales Invoice is reactivated. CORRECT
9) Navigate back to the Goods Shipment created, click on Close button and select Void: Goods Shipment is reversed. CORRECT
10) Navigate back to the Sales Order, click on Close button and select Reactivate: Sales Order is reactivated. CORRECT
11) Navigate to Lines and change Ordered Quantity to 3 (Delivered Quantity = 0 and Invoiced Quantity = 0).
12) Navigate back to Header and Complete the Sales Order: a new Shipment is automatically created.
13) Navigate to the previous Sales Invoice and re-Complete it.
14) Navigate to Generate Invoices process Sales Management || Transactions || Generate Invoices
15) Select the former Sales Order and click on OK: It is not possible to complete the invoice xxxx line 10. Order No. xxxx: Invoiced Quantity cannot be higher than Ordered Quantity. CORRECT
16) Navigate to the previous Sales Invoice and reactivate it.
17) Navigate to Generate Invoices process Sales Management || Transactions || Generate Invoices
18) Select the former Sales Order and click on OK: a new Sales Invoice is created automatically.
20) Navigate to the Sales Order line and check that:
* Order Quantity = 3
* Delivered Quantity = 3
* Invoiced Quantity = 3

SALES ORDER WITH NEGATIVE QUANTITIES

1) Create a Sales Order Sales Management || Transactions || Sales Order
* Transaction Document = Warehouse Order
* Invoice Terms = After Delivery
2) Navigate to Lines tab and create a new record:
* Product = Hammer
* Ordered Quantity = -2
3) Navigate back to Header and Complete the Sales Order: a new Shipment is automatically created.
4) Navigate to Generate Invoices process Sales Management || Transactions || Generate Invoices
5) Select the former Sales Order and click on OK: a new Sales Invoice is created automatically.
6) Navigate to the Sales Order line and check that:
* Order Quantity = -2
* Delivered Quantity = -2
* Invoiced Quantity = -2
7) Navigate to the Goods Shipment created, click on Close button and select Void: Shipment No. : xxxx line : 10. It is not possible to void a shipment of an order that has an invoice rule after delivery having invoiced lines. CORRECT
8) Navigate to the Sales Invoice created, click on Reactivate button and select Reactivate: Sales Invoice is reactivated. CORRECT
9) Navigate back to the Goods Shipment created, click on Close button and select Void: Goods Shipment is reversed. CORRECT
10) Navigate back to the Sales Order, click on Close button and select Reactivate: Sales Order is reactivated. CORRECT
11) Navigate to Lines and change Ordered Quantity to -3 (Delivered Quantity = 0 and Invoiced Quantity = 0).
12) Navigate back to Header and Complete the Sales Order: a new Shipment is automatically created.
13) Navigate to the previous Sales Invoice and re-Complete it.
14) Navigate to Generate Invoices process Sales Management || Transactions || Generate Invoices
15) Select the former Sales Order and click on OK: It is not possible to complete the invoice xxxx line 10. Order No. xxxx: Invoiced Quantity cannot be higher than Ordered Quantity. CORRECT
16) Navigate to the previous Sales Invoice and reactivate it.
17) Navigate to Generate Invoices process Sales Management || Transactions || Generate Invoices
18) Select the former Sales Order and click on OK: a new Sales Invoice is created automatically.
20) Navigate to the Sales Order line and check that:
* Order Quantity = -3
* Delivered Quantity = -3
* Invoiced Quantity = -3
(0022525)
sureshbabu   
2009-12-08 07:48   
Tested working fine
(0166618)
hgbot   
2024-07-02 17:07   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.ssms/-/merge_requests/231 [^]
(0166804)
hgbot   
2024-07-08 14:52   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.ssms/-/merge_requests/231 [^]