Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0010836Openbravo ERP09. Financial managementpublic2009-09-30 20:292010-05-18 21:44
psarobe 
sivaraman 
urgentmajoralways
closedfixed 
5
2.50MP6 
2.50MP17 
Core
No
0010836: Oracle: Payment due date isnot calculated correctly
This is the scenario:
Payment term: 90 days
Invoice date: 30/09/2009
Process the purchase invoice

The due date for the payment should be 30/12/2009 but the ERP calculates 31/12/2009

Only happens in Oracle
Pre-requisites: Have a payment term of 90 days (3 month)

1. Create a purchase invoice
2. Select a payment term 3 months
3. Invoice date= 30/09/2009
4. Complete the invoice

The payment due date will be 31/12/2009 and it's wrong
No tags attached.
Issue History
2009-09-30 20:29psarobeNew Issue
2009-09-30 20:29psarobeAssigned To => rafaroda
2009-09-30 20:29psarobeStatusnew => scheduled
2009-09-30 20:29psarobefix_in_branch => pi
2010-02-11 18:13rafarodaAssigned Torafaroda => adrianromero
2010-05-01 20:07psarobeTarget Version2.50MP7 => 2.50MP16
2010-05-01 20:07psarobefix_in_branchpi =>
2010-05-04 18:28adrianromeroNote Added: 0026941
2010-05-11 18:19jpabloaeTarget Version2.50MP16 => 2.50MP17
2010-05-14 07:04sivaramanAssigned Toadrianromero => sivaraman
2010-05-14 08:37hgbotCheckin
2010-05-14 08:37hgbotNote Added: 0027218
2010-05-14 08:37hgbotStatusscheduled => resolved
2010-05-14 08:37hgbotResolutionopen => fixed
2010-05-14 08:37hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/7f8f01670ddd57603ad4b0c2a583d1982603f18d [^]
2010-05-14 08:38sivaramanNote Added: 0027219
2010-05-15 16:37sureshbabuNote Added: 0027329
2010-05-15 16:37sureshbabuStatusresolved => closed
2010-05-16 00:00anonymoussf_bug_id0 => 3002195
2010-05-18 21:44hudsonbotCheckin
2010-05-18 21:44hudsonbotNote Added: 0027524

Notes
(0026941)
adrianromero   
2010-05-04 18:28   
Probably the error is in the PL/SQL function that calculates payment dates:
c_paymentduedate()
(0027218)
hgbot   
2010-05-14 08:37   
Repository: erp/devel/pi
Changeset: 7f8f01670ddd57603ad4b0c2a583d1982603f18d
Author: Sivaraman Rajagopal <sivaraman.rajagopal <at> openbravo.com>
Date: Fri May 14 12:06:44 2010 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/7f8f01670ddd57603ad4b0c2a583d1982603f18d [^]

Fixes issue 10836: Oracle: Payment due date isnot calculated correctly.

As per ADD_MONTHS function in oracle, If date is the last day of the month or if the resulting month has fewer days than the day component of date, then the result is the last day of the resulting month. To overcome this in our case, C_ADD_MONTHS2 has been used instead of ADD_MONTHS.

---
M src-db/database/model/functions/C_PAYMENTDUEDATE.xml
---
(0027219)
sivaraman   
2010-05-14 08:38   
Steps to test:

1. Log on to Openbravo with 'Openbravo Admin' role
2. Go to Master Data Management || Business Partner Setup || Payment Term
3. Create new record with the following details
    Search Key : 3-months
    Name : 3 Months
    Offset Month Due : 3
4. Save & Go to Procurement Management || Transactions || Purchase Invoice || Header
5. Create new record with the following details
    Invoice Date : 30-09-2009
    Business Partner : McGiver Supplies
    Payment Term : 3 Months
6. Save and Go to Procurement Management || Transactions || Purchase Invoice || Header >> Lines
7. Create new line for 'Hat' product
8. Save and come back to Procurement Management || Transactions || Purchase Invoice || Header
9. Click and execute 'Complete'
10. Go to Procurement Management || Transactions || Purchase Invoice || Header >> Payment
11. Verify Due Date field
(0027329)
sureshbabu   
2010-05-15 16:37   
Verified now payment due date rightly assigned as 30/09/2009
(0027524)
hudsonbot   
2010-05-18 21:44   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/7f8f01670ddd [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/aa11838d5f80 [^]
Tests: http://builds.openbravo.com/view/devel-int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17380.obx [^]