Invoicing error in due date calculation for 01/31/2013

Bug #1126282 reported by Damien D.

This bug report was converted into a question: question #222445: Invoicing error in due date calculation for 01/31/2013.

20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Addons Team 3

Bug Description

Hi all,

due date is not calculated correcty only for an invoice date of 01-31-2013 (and 01-31-2014, and so on ...)
invoicing date: 01-31-2013
Payment term: 90 days end of month
due date should be 04-30-2013

I set this payment term in Accounting > Configuration > Payment Term
Valuation: balance
Number of days: 90
Day of the month: -1

With that OpenERP gives me 05-31-2013 for the due date

What is very strange is that OpenERP computes correctly the due date for all the other days of the years...
invoicing date due date
02-28-2013 05-31-2013 OK
03-31-2013 06-30-2013 OK
etc....

You can try this here:
http://54.228.22.65:48080
db: Test_Compta
user: admin
pwd: kazacube

Thanks for your help!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Shahin Belim(OpenERP Trainee) (shahin.belim-openerp-deactivatedaccount) wrote :

Hello Damien,
 I have gone through your suggested bug,
there is no error in calculation of due date. Here you set payment term 90 Days end of month.
If invoice date is: 01-31-2013. so, according to payment term if we calculate 90 days after 31st January it will be 5/1/2013. Because there are 28 days in February.
Now if you set payment term in Accounting > Configuration > Payment Term
Valuation: balance
Number of days: 90
Day of the month: -1 (If you set Day of Month : -1 Return last day of the current month
                             : 0 Return net days
                          :+ve It gives day of the next month)

It will give last date of month(5/31/2013).

Changed in openobject-addons:
status: Confirmed → Invalid
Revision history for this message
Leonardo Donelli (learts92) wrote :

Shahin while the computation is teorically correct it is not 'practically'.
Suppose i want to set up a payment term that sets the due date to the last day of next month (which is extremely common).
At the moment, *there is no way to do that*.

If you use
    number of days: 30
    day of the month: -1

It won't work for invoices with date 31 January: +30 days goes to 1 March, -1 goes to 31 March.

If you use
   number of days: x < 30
   day of the mont: -1

It won't work for invoices with date 1 January: +x goes at most to 30 January, -1 goes to 31 January.

Strictly speaking this is not a matter of wrong calculations, but missing functionalities.
An alternative found in some community modules written explicitly to solve this issue is to let the user specify, in addition to number of days, the number of months.

Changed in openobject-addons:
status: Invalid → Confirmed
Revision history for this message
Leonardo Donelli (learts92) wrote :

I forgot: in the examples above the correct date should be 28 February (or 29 February for leap years).

Revision history for this message
Franco Tampieri (dr.dran) wrote :

I agree with Leonardo, i think that adding a field "number of month" to add a month to the curret due date will help to solve this issue

Revision history for this message
Nicola Riolini - Micronaet (nicolariolini) wrote :

+1 dr.dran feature proposal, a field for add month instead of days resolve the problem, alternatives:
- add a selection with: day, month, (year), day = defaults
- use a char field with some 'parse' rule, ex.: 1 = 1 day, 1m = 1 month

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.