Payment term Date computation needs attention!

Bug #560459 reported by Moisés López - http://www.vauxoo.com
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Status tracked in Trunk
5.0
Won't Fix
Undecided
Unassigned
Trunk
Fix Released
Medium
OpenERP Accounting Experts

Bug Description

In computing next_date, add 1 month from source code, but you should be configurable, and it is not always well.

These can be configurable since the model: account.payment.term.line
adding a field: months

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Saludos,
Sorry I could not understand the question well.
Would you please make it more clear from your side? It would be better if you can go through examples.
Thanks.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Hello Jay
In the same way you pass the video, by which I express

Can you see?

regards

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Hello Jay

Do you have a problem with the video?

Changed in openobject-addons:
importance: Undecided → Medium
milestone: none → 5.0.10
status: Incomplete → Confirmed
summary: - Should compute the sum of months so configurable in account/account.py
- - def account_payment_term
+ Payment term Date computation needs attention!
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Experts,

We need your views here for payment date calculation.

There are 2 fields that are responsible for counting the date.

1. Number of Days 2. Day of the month.

The scenario is:
A. If I select 0 days as no. of days:
    1. If the day of the month is -1, it has to take the end date of current month.
    2. If the day of the month is positive(say 12), the 12th of this month has to be the final date.

for 2. Currently it takes, next months date + day of that month.

B. If I select 30(any number >0) days as no. of days:
    1. If the day of the month is -1, it has to count like current date+ 30 days, and the end date of the resulting month.
    2. If the day of the month is positive(say 12),it has to count like current date + 30 days, and the 12th date of the resulting month.

Currently, for positive days (for day of month), it considers the next to next month.

Please refer the patch and check.

Thanks.

Changed in openobject-addons:
status: Confirmed → In Progress
Changed in openobject-addons:
assignee: nobody → OpenERP's Accounting Experts (openerp-expert-accounting)
Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Before applying that patch, you should take a look at this module: http://bazaar.launchpad.net/~openerp-spain-team/openerp-spain/5.0/files/head%3A/extra_addons/paydays/

That module was developed to solve just this kind of 'unfriendly' behaviour.

Currently OpenERP calculates the next_date from the end of the current month begining of the next month. If we use "-5" it means "five days before the end of the current month", if we use "+5" it means "the fifth day of the next month"; there is no way to say "the fifth day of this month".

That module (from the Spanish localization) extends the payment terms configuration to allow to select more than one payment date. So you may say for example that a partner has as payment days the 10th and the 20th of each month with just setting the 'payment days' to "15,20"; also, it solves my previous "the fifth day of this month" example by just setting the 'payment days' to "5".

Maybe the features of this module should be merged into the standard payment term object, or at least the module might be ported to extra-addons or addons (it's currently hosted on the openerp-spain branch).

P.D.: Jay be aware that your patch might break things for a lot of people that already configured their payment terms the old way.

Revision history for this message
Ferdinand (office-chricar) wrote :

I doubt that this definition is userfriendly (even if it is technically correct)

may be a "real time" example should be available in the payment term definition
* enter a date and see the computed result.
so user can play around and see if the system behaves as expected.

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Ferdinand: Good idea, indeed.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello,

I agree that current patch will not match previous date calculations, but we want a generic solution.

1. I am planning to put a button to review payment date on payment line, so we can test date.(as per comment #6).

2. Final logic has to be:
    date1= Supplied DATE + number of days
    final date = (day of the month) Of the date1

Current calculation considers always next month if day of the month is -1. If Day of the month is positive,it goes for next to next month.

Share your views please.

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

I think that the value assigned from code "month = 1"
Adding a field "NEXT_MONTH" in the model, with a default value to 1.
And is processed only when the num_days is positive.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Experts,
The current scenario is configurable to adjust any date,although if we may find it a little un-user-friendly.
We only have to adjust Number Of days and Day of the month. You may ask me if you want to adjust any date.

However, for the trunk version we will propose a patch which will behave like this:

1. Number of Days ( which will be added to the date of invoice) - Normal as what in current stable.
2. Date Crtiteria : a selection box with choices: A. End of the month B. Specific Day C. Start of the month D.Day of the week(I' m not sure about the D option to be professional).
3 Day of the Month : It will behave acc. to what is selected for Date Criteria.

So, using these 3 fields, users would have a clear idea about what would be the expected Payment date.

Queries and suggestions are invited.

Thanks a lot for your concern.

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Jay, instead of a "day of the month" I would use a "days of the month" letting the user select more than one payment day.

On Spain is pretty usual for companies to have 2 pay days, for example the 10th and 25th of each month.

For Spain this is what would be needed:

1. Date criteria: From invoice date | From end of the month | From the start of the current month
2. Number of days: Number of days to add to the date in the date criteria before searching for a "pay day" (if there are no "pay days" defined, then we would use this day). If the day is in the past, then 'jump' to the next month.
3. Pay days: A list of days valid for payments (split by comas). The first payment day from the day calculated will be used.

Some examples:

    * Date criteria: From end of the month
    * Number of days: -5
    * Pay days: (empty)

Invoice dated 2010-04-08 ==> payment on 2010-04-26;
Invoice dated 2010-04-17 ==> payment on 2010-04-26;
Invoice dated 2010-04-27 ==> payment on 2010-05-27.

    * Date criteria: From invoice date
    * Number of days: 30
    * Pay days: 10, 25

Invoice dated 2010-04-08 ==> payment on 2010-05-10;
Invoice dated 2010-04-17 ==> payment on 2010-05-25;
Invoice dated 2010-04-27 ==> payment on 2010-06-10.

    * Date criteria: From the start of the current month
    * Number of days: 10
    * Pay days: (empty)

Invoice dated 2010-04-08 ==> payment on 2010-04-10;
Invoice dated 2010-04-17 ==> payment on 2010-05-10;
Invoice dated 2010-04-27 ==> payment on 2010-05-10.

I think that with those three options you cover pretty much all the use cases.

Revision history for this message
gpa(OpenERP) (gpa-openerp) wrote :

Hello Guys,

I attached the following patch.

Would you please check this?

It is not a final patch.

Thanks

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

This facility has been improved in trunk.
Date of payment is more adjustable now.

Let us know if this still needs correction.
Thanks again.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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