Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0024807Openbravo ERP07. Sales managementpublic2013-09-20 16:482014-03-24 11:23
jonalegriaesarte 
pramakrishnan 
normalminorhave not tried
closedfixed 
5
 
3.0PR14Q23.0PR14Q2 
jonalegriaesarte
Core
No
0024807: Close order should check if the order has prepayments associated
Close order should check if the order has prepayments associated. In this case, it should check if the amount of the order is less than the prepayment associated to the order
1) Create and book a sales order
2) Record a payment in against that sales order and process it
3) Close the sales order (which makes total zero)
No tags attached.
Issue History
2013-09-20 16:48jonalegriaesarteNew Issue
2013-09-20 16:48jonalegriaesarteAssigned To => jonalegriaesarte
2013-09-20 16:48jonalegriaesarteModules => Core
2013-09-20 16:48jonalegriaesarteTriggers an Emergency Pack => No
2013-10-14 16:37jonalegriaesarteTarget Version3.0MP29 => 3.0MP30
2013-11-25 10:32jonalegriaesarteAssigned Tojonalegriaesarte => pramakrishnan
2013-12-02 06:50gauravdeshmukhNote Added: 0062473
2013-12-02 09:55jonalegriaesarteTarget Version3.0MP30 => 3.0MP31
2013-12-06 05:14eintelauIssue Monitored: eintelau
2013-12-06 05:17eintelauNote Added: 0062658
2013-12-11 09:53pramakrishnanAssigned Topramakrishnan => gauravdeshmukh
2013-12-11 10:44gauravdeshmukhNote Edited: 0062473bug_revision_view_page.php?bugnote_id=0062473#r5243
2014-01-02 12:38jonalegriaesarteTarget Version3.0MP31 => 3.0MP32
2014-01-16 08:28gauravdeshmukhNote Edited: 0062473bug_revision_view_page.php?bugnote_id=0062473#r5340
2014-01-24 11:45eduardo_ArgalNote Added: 0063670
2014-01-24 11:45eduardo_ArgalStatusnew => feedback
2014-02-06 01:35eintelauNote Added: 0063941
2014-02-21 11:43gauravdeshmukhNote Added: 0064486
2014-02-21 11:43gauravdeshmukhStatusfeedback => scheduled
2014-02-26 10:37gauravdeshmukhNote Edited: 0064486bug_revision_view_page.php?bugnote_id=0064486#r5499
2014-03-04 07:25pramakrishnanReview Assigned To => pramakrishnan
2014-03-04 07:25pramakrishnanNote Added: 0064774
2014-03-04 07:25pramakrishnanStatusscheduled => closed
2014-03-04 07:25pramakrishnanResolutionopen => no change required
2014-03-05 09:43pramakrishnanAssigned Togauravdeshmukh => pramakrishnan
2014-03-05 09:43pramakrishnanNote Added: 0064809
2014-03-05 09:43pramakrishnanStatusclosed => new
2014-03-05 09:43pramakrishnanResolutionno change required => open
2014-03-05 09:43pramakrishnanReview Assigned Topramakrishnan => jonalegriaesarte
2014-03-05 09:43pramakrishnanStatusnew => scheduled
2014-03-05 09:46hgbotCheckin
2014-03-05 09:46hgbotNote Added: 0064811
2014-03-05 09:46hgbotStatusscheduled => resolved
2014-03-05 09:46hgbotResolutionopen => fixed
2014-03-05 09:46hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/b80b2480439541f50e07aa6b46638e7eba65bf93 [^]
2014-03-06 04:24hudsonbotCheckin
2014-03-06 04:24hudsonbotNote Added: 0064876
2014-03-24 11:23jonalegriaesarteNote Added: 0065381
2014-03-24 11:23jonalegriaesarteStatusresolved => closed
2014-03-24 11:23jonalegriaesarteFixed in Version => PR14Q2

Notes
(0062473)
gauravdeshmukh   
2013-12-02 06:50   
(edited on: 2014-01-16 08:28)
1) Login with admin role
2) Create and book a sales order
3) Record a payment in against that sales order and process it
4) now goto sales order and try to close the sales order ,It will check if prepayment is associated with then following error message will be shown
 "Prepayment associated with order.

Point to consider

1.If prepayment amount is greater than amount of qty delivered then on close action of sales order should raise an exception as 'Prepayment associated with order'.
2.If prepayment amount is less than amount of qty delivered then sales order is closed with quantity= qtydelivered.
3.If No quantity is delivered/invoiced then on close action of sales order should raise an exception as 'Prepayment associated with order'.

Example:

Consider there is an order with to lines one with product A - 2.00(1 qty) and other product B - 3.00(1 qty). So the total gross of the order is 5.00(assume, there is no tax).

Now,

1. When there is a prepayment of amount 5.00 and qtydelivered = 0, then system should throw the error.
2. When there is a prepayment of amount 2.00 and qtydelivered = 0, then system should throw the error
3. When there is a prepayment of amount 3.00 and qtydelivered = 1(product B), then system should not throw any error. The system will already handle this case, by closing the order after changing the order gross amount to 3.00
4. When there is a prepayment of amount 5.00 and qtydelivered = 2(both product A & B), then system should not throw any error. This case is also already handled.
5. When there is no prepayment, then the order should be allowed to be closed.

(0062658)
eintelau   
2013-12-06 05:17   
Please note that it is valid to close a partially delivered sales order with a prepayment, as long as the final amount of the order is >= the prepayment.

e.g
1) Create sales order with 2 line of value $100 each
2) Book order
3) Add prepayment of $100
4) Ship first line of sales order
5) Close sales order

This will result in closed sales order with value $100 and payment of $100
(0063670)
eduardo_Argal   
2014-01-24 11:45   
we consider this not to be an issue.
Ex:
A customer registers an order for 100 units of product A and does a prepayment for that order. Afterwards the customer finds this is in fact wrong and does not want to continue with this order so wants to cancel that order.
System is allowing to close the order, setting qty and amount to 0. Once done that system still recognizes the order was originally fully paid. Anyway the payment details of the order changes. It now holds an additional detail to be paid against this 0 amount order of a negative amount of 100. This means that system allows to create a negative payment and return that money to the customer.

This will apply both for sales and purchase flows.
Please help me to understand why we should consider this as a bug, as at this point we consider this as a valid flow.

Thanks in advance
(0063941)
eintelau   
2014-02-06 01:35   
Hi,
The business flow you describe seems valid to me as well. So I am happy to keep that behaviour

However the original problem that prompted this issue was slightly different (see support case 23523).

If an order is closed with a prepayment & the user wants to reactivate that payment (e.g payment was recorded incorrectly), then the reactivate payment process fails with a NullPointerException because there is no invoice schedule associated with the payment.

thanks
Ben
(0064486)
gauravdeshmukh   
2014-02-21 11:43   
(edited on: 2014-02-26 10:37)
The description of the support case 23523, is:
"Steps to reproduce (MP24.2)
1) Create and book a sales order
2) Record a payment in against that sales order and process it
3) Close the sales order (which makes total zero)
4) Try to reactivate payment and delete lines

This results in an error caused by a NullPointException
java.lang.NullPointerException
at org.openbravo.advpaymentmngt.process.FIN_PaymentProcess.execute(FIN_PaymentProcess.java:796)

When the process tries to delete payment schedule details with amounts of zero, it doesn't check if it has a non-null Invoice (or Order)
schedule attached"

(0064774)
pramakrishnan   
2014-03-04 07:25   
Fixed in pi change set https://code.openbravo.com/erp/devel/pi/rev/87765308f9bd [^]
(0064809)
pramakrishnan   
2014-03-05 09:43   
Issue still reproducible
(0064811)
hgbot   
2014-03-05 09:46   
Repository: erp/devel/pi
Changeset: b80b2480439541f50e07aa6b46638e7eba65bf93
Author: Pandeeswari Ramakrishnan <pandeeswari.ramakrishnan <at> openbravo.com>
Date: Wed Mar 05 14:14:21 2014 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/b80b2480439541f50e07aa6b46638e7eba65bf93 [^]

Fixes Issue 24807: NPE when reactivate and delete the payment associated with closed order

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
---
(0064876)
hudsonbot   
2014-03-06 04:24   
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/94a044af1a46 [^]
Maturity status: Test
(0065381)
jonalegriaesarte   
2014-03-24 11:23   
Tested and working fine.