Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037724Openbravo ERP07. Sales managementpublic2018-01-25 12:012018-02-22 18:19
aferraz 
markmm82 
normalmajorhave not tried
closedfixed 
30Openbravo Appliance 14.04
 
3.0PR18Q2 
dmiguelez
Core
No
0037724: Error when cancel and replace a sales order of zero amount
Error when cancel and replace a sales order of zero amount
Enable Cancel and Replace functionallity: http://wiki.openbravo.com/wiki/How_to_manage_Cancel_and_Replace_process#Objective [^]

Create a Sales Order.
Add one line for any product with quantity 1 and price 10.
Add amother line for any product with quantity -1 and price 10.
Check order gross and net amounts are zero.
Complete the order.

Click on Cancel and Replace.
Check a new order is created in temporal status.

Click on Confirm Cancel and Replace.
Check following error is thrown:
org.openbravo.base.exception.OBException: There is no payment plan for the order.
No tags attached.
Issue History
2018-01-25 12:01aferrazNew Issue
2018-01-25 12:01aferrazAssigned To => Triage Finance
2018-01-25 12:01aferrazModules => Core
2018-01-25 12:01aferrazTriggers an Emergency Pack => No
2018-01-26 09:27dmiguelezAssigned ToTriage Finance => AtulOpenbravo
2018-02-01 11:26dmiguelezAssigned ToAtulOpenbravo => markmm82
2018-02-01 16:04markmm82Statusnew => acknowledged
2018-02-05 22:08markmm82Statusacknowledged => scheduled
2018-02-06 17:10markmm82Note Added: 0102223
2018-02-07 18:47hgbotCheckin
2018-02-07 18:47hgbotNote Added: 0102265
2018-02-07 18:47hgbotStatusscheduled => resolved
2018-02-07 18:47hgbotResolutionopen => fixed
2018-02-07 18:47hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e2d3bd2597874f2fe7b16c22ee1115d181565652 [^]
2018-02-07 18:48dmiguelezReview Assigned To => dmiguelez
2018-02-07 18:48dmiguelezNote Added: 0102266
2018-02-07 18:48dmiguelezStatusresolved => closed
2018-02-07 18:48dmiguelezFixed in Version => 3.0PR18Q2
2018-02-22 18:19hudsonbotCheckin
2018-02-22 18:19hudsonbotNote Added: 0102731

Notes
(0102223)
markmm82   
2018-02-06 17:10   
Test Plan:
As Group Admin:
  Go to preference window and enable Enable Cancel and Replace preference.
  Go to Sales Order window and create a new one:
    Organization = F&B España - Región Norte
    Transaction = Standard Order
    Business Partner = Alimentos y Supermercados, S.A
  Add a line to the created order
    Product = Cerveza Ale 0,5 L
    Ordered Quantity = 1
    Net Unit Price = 2.04
    Tax = Ventas exentas
  Add a line to the created order
    Product = Cerveza Ale 0,5 L
    Ordered Quantity = -1
    Net Unit Price = 2.04
    Tax = Ventas exentas
  Book the order
    Notice the Total Net Amount = Total Gross Amount = 0.00
    Notice in Payment Plan Tab, that wasn't generated any payment plan to this order.
    Take note of the document number of the order, for instance 1000244.
  Execute Cancel and Replace process
    Notice a new order in Temporal Status was created with document no: 1000244-1
    Notice the new order has the same information than the cancelled one:
      Total Net Amount = Total Gross Amount = 0.00
      Lines
      Payment Plan is empty
  Execute Confirm Cancel and Replace
    Notice the process is completed successfully.
    Notice a new order was created (1000244*R*) reversing the original one (1000244)

  Go to Sales Order window and create a new one:
    Organization = F&B España - Región Norte
    Transaction = Standard Order
    Business Partner = Alimentos y Supermercados, S.A
  Add a line to the created order
    Product = Cerveza Ale 0,5 L
    Ordered Quantity = 1
    Net Unit Price = 2.04
    Tax = Ventas exentas
  Add a line to the created order
    Product = Cerveza Lager 0,5L
    Ordered Quantity = 1
    Net Unit Price = 2.64
    Tax = Ventas exentas
  Remove discounts if exist.
  Book the order
    Notice the Total Net Amount = Total Gross Amount = 4.68
    Notice in Payment Plan Tab, that was generated a payment plan to this order of 4.68.
    Take note of the document number of the order, for instance 1000245.
  Execute Cancel and Replace process
    Notice a new order in Temporal Status was created with document no: 1000245-1
    Notice the new order has the same information than the cancelled one:
      Total Net Amount = Total Gross Amount = 4.68
      Lines
      Payment Plan is empty
  Execute Confirm Cancel and Replace
    Notice the process is completed successfully.
    Notice a new order was created (1000245*R*) reversing the original one (1000245)
    A new Payment Plan was generated according the total gross amount of the order
(0102265)
hgbot   
2018-02-07 18:47   
Repository: erp/devel/pi
Changeset: e2d3bd2597874f2fe7b16c22ee1115d181565652
Author: Mark <markmm82 <at> gmail.com>
Date: Tue Feb 06 10:43:49 2018 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/e2d3bd2597874f2fe7b16c22ee1115d181565652 [^]

Fixes issue 37724: Error when cancel and replace a sales order of zero amount

When an order with grand total of ZERO is created and booked, no Payment Plan is
created for it, so when she is cancelled and replaced the new created orders haven't
payment plans neither.

So, when the Cancell and Replace process is executed on orders of this kind, the
it was failing trying to get get the payment schedule detail of the oldOrder and
an exception was thrown.

To fix this issue, only will be created Payments to orders with grand total different
than ZERO to avoid the exception and keep the current behaviour for this kind of orders

---
M src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceUtils.java
---
(0102266)
dmiguelez   
2018-02-07 18:48   
Code Review + Testing Ok
(0102731)
hudsonbot   
2018-02-22 18:19   
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/980a6ad5bbf5 [^]
Maturity status: Test