Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0043155Openbravo ERP07. Sales managementpublic2020-02-10 09:592020-02-26 09:49
shankarb 
Triage Omni OMS 
normalmajoralways
acknowledgedopen 
30Openbravo Appliance 14.04
 
 
Core
No
0043155: Cancel and Replace Sales Order does not take into account Invoiced Quantity
There seems to be a bug in the Cancel-Replace logic causing serious issue with the customer. If you book an order with 2 lines and then ship and invoice one of them. If I go to the sales order window I can see that the order is partially delivered and invoiced. (i.e. the percent on the order reflects that the order-qty, delivered-qty and invoiced-qty on the SO Line) If I then do a cancel-replace the delivered quantity is retained on the new -1 order but the invoiced quantity is lost. This makes it difficult for users to see what is left to invoice on the Order and leads to duplicate invoicing.
1. Enable Preference 'Enable Cancel and Replace'.
2. Create Sales Order, add lines and book.
3. Deliver partially or fully.
4. Invoice partially
5. Go to the Sales order and click 'Cancel and Replace'.
6. Confirm the Cancel and Replace.
7. In the new Sales Order created, the Invoiced Quantity is not carried over.
In the createReplacementOrder method in CancelAndReplaceUtils.java, the following code is there.

        newOrderLine.setDeliveredQuantity(BigDecimal.ZERO);
        newOrderLine.setReservedQuantity(BigDecimal.ZERO);
        newOrderLine.setInvoicedQuantity(BigDecimal.ZERO);

This has to be verified and updated from the orderline itself or the spec has to be updated here[1] to reflect this scenario. There is a logic for service products, but not for regular products.

[1] http://wiki.openbravo.com/wiki/How_to_manage_Cancel_and_Replace_process#Sales_order_cancel_and_replace [^]
No tags attached.
Issue History
2020-02-10 09:59shankarbNew Issue
2020-02-10 09:59shankarbAssigned To => Triage Finance
2020-02-10 09:59shankarbModules => Core
2020-02-10 09:59shankarbResolution time => 1583103600
2020-02-10 09:59shankarbTriggers an Emergency Pack => No
2020-02-12 08:30dmiguelezAssigned ToTriage Finance => AtulOpenbravo
2020-02-12 18:51AtulOpenbravoStatusnew => scheduled
2020-02-14 08:25shankarbSummaryCancel and Replace Sales Order does not take into account Invoiced or Delivered Quantity => Cancel and Replace Sales Order does not take into account Invoiced Quantity
2020-02-14 08:25shankarbSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20370#r20370
2020-02-17 07:09AtulOpenbravoNote Added: 0117841
2020-02-17 10:01AtulOpenbravoNote Edited: 0117841bug_revision_view_page.php?bugnote_id=0117841#r20380
2020-02-26 09:48dmiguelezNote Added: 0118108
2020-02-26 09:48dmiguelezTypedefect => design defect
2020-02-26 09:48dmiguelezStatusscheduled => acknowledged
2020-02-26 09:49dmiguelezAssigned ToAtulOpenbravo => Triage Finance

Notes
(0117841)
AtulOpenbravo   
2020-02-17 07:09   
(edited on: 2020-02-17 10:01)
Test Plan

- Login in as F&B International Group Admin.
- Enable Preference 'Enable Cancel and Replace'. Logout and Log in.
- Create Sales Order in F&B US Inc organization, Business Partaner: Moon Light Restaurants, Co.
- Add line for product: Ale Beer, Quantity : 100 and book it.
- Create a Good Shipment for 10 units using "Create Lines From" against above Sales Order.
- Create a Sales Invoice for 5 units using "Create Lines From Shipment" against above Goods Shipment.
- Go to the Sales order (refresh), realize that Delivery Status is 10%, Invoice Status is 5%
- click 'Cancel and Replace'. Press Done.
- Realize that New Order is created in Temporal document status.
- Edit the Quantity as 150 instead of 100.
- Confirm the Cancel and Replace. Using Confirm Cancel and Confirm Press Done.
- Realize that Temporal Order gets Booked status and open a line with Product Ale Beer in form view.
- Check Delivery Quantity = 10 and Invoiced Quantity = 5. This is correct and the quantity that was delivered and invoiced in old order is carried forward in the new order as it.

(0118108)
dmiguelez   
2020-02-26 09:48   
After an internal discussion within the team, we have decided to updated this issue to design defect.

The reason is that it is necessary to manage the Invoices in a more sophisticated way, not just changing the Invoiced Status query.
However, this can not be done exactly as it is done for Shipments. Shipments can be automatically generated, but Invoices can not, because the client should decide how to manage them.

There are several scenarios to take into account.
  - If Invoices are done against the Order or against the Shipment
  - If the 'Net Shipments' preference is enabled
  - If the 'Link Shipment with new Order' preference is enabled

When cancel and replace is done, the user ends up with three different documents in the Orders:
  - Original Order
  - Canceled Order
  - Replacement Order

In general, in the case of an Invoice that has been done against the original Order, the original Order Invoiced Status should reflect what was Invoiced.
Then the user can decide how to manage the invoicing of the canceled and replacement Orders.

If the Invoice has been done against the Shipment, then the link in the Invoice Line that points to the Order should be managed (depending on the preferences) to point to the Replacement Order.
In this case, the Invoiced Status of the Replacement Order must include the Invoiced quantity against the Shipment.

However, due to the many scenarios to consider in this issue, and the complexity of it, we have decided to catalog this issue as a design defect.