no option for running monthly cron jobs at end of each month

Bug #1190112 reported by Will Stokes
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Committed
Wishlist
OpenERP's Framework R&D

Bug Description

A bug fix branch will be submitted and linked shortly

Related branches

Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :

Hello Will Stokes,

Would you please provide more information about your issue?

Thank you.

Changed in openobject-server:
status: New → Incomplete
Revision history for this message
Will Stokes (will-q) wrote :

Copied from merge proposal:

Adds a monthsend interval_type and special handling which it requires.

This change also fixes existing subtle bug that could affect monthly crons. In explaining it, hopefully it will help clarify why the new method works the way it does.

The issue is easiest to see by example:

Take user who has timezone Pacific/Auckland (NZST +12 or NZDT +13)
If they set up a monthly job to run from the 31st of May, they will then see the next run scheduled for 1st July (NZST) instead of 30th June.

To show how that happens -
UI (NZST) -> DB (UTC) -> add month DB (UTC) -> UI (NZST)
31/05 10am -> 30/05 10pm -> 30/06 10pm -> 01/07 10am

Since this issue also affects monthsend calculations the fix adds a new method to perform date calculation in the timezone of the user running the job (if they have one set). So the flow is instead:

UI (NZST) -> DB (UTC) -> Local -> add month Local -> DB (UTC) -> UI (NZST)
31/05 10am -> 30/05 10pm -> 31/05 10am -> 30/06 10am -> 29/06 10pm -> 30/06 10am

With this fix, the additional monthsend interval type is handled as a special case of month interval type. It localizes the datetime as above but then has to move that to be the first of the month so that date calculation is thereby a simple add extra month and subtract a day.

A followup change to openobject-addons/subscription/subscription.py will be required for change to be used by users setting up recurring events. It is only:
- 'interval_type': fields.selection([('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], 'Interval Unit'),
+ 'interval_type': fields.selection([('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months'), ('monthsend', 'End of Months')], 'Interval Unit'),

Revision history for this message
Will Stokes (will-q) wrote :

We would like to be able to automatically send invoices out at the end of each month (for such things as hosting charges). The current Monthly interval is not working because for example 28th Feb increments to the 28th March for the next run which isn't the end of March.

As explained above there is also an issue with monthly increments from months with 31 days at least for us where our timezone is +1200. This has been fixed while adding monthsend interval type as it was also an issue for that.

Will Stokes (will-q)
Changed in openobject-server:
status: Incomplete → New
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

Consider as a Improvement.

Thanks for the merge.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Wishlist
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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