Skip to content

[16.0][MIG] cron_daylight_saving_time_resistant - #2578

Merged
OCA-git-bot merged 12 commits into
OCA:16.0from
akretion:16.0-mig-cron_daylight_saving_time_resistant
Jan 29, 2024
Merged

OCA-git-bot merged 12 commits into
OCA:16.0from
akretion:16.0-mig-cron_daylight_saving_time_resistant

Conversation

@florian-dacosta

Copy link
Copy Markdown
Contributor

Based on #2289

The module allows to configure crons so they always run at the same hour, no matter the timezone and the change of hours.
For instance, if you are in Brussels and you have a cron that run every days at 11H (local time), when swtiching from summer time to winter time, the cron will be planned for the next day at 10H (local time)
At the contrary when switching from winter time to summer time, the cron that was configured to run at 11H will be planned for 12H.
If it is important that the cron always run at the same hour no matter the change of time, then you can check the box "daylight_saving_time_resistant" on the cron.

@florian-dacosta
florian-dacosta force-pushed the 16.0-mig-cron_daylight_saving_time_resistant branch 2 times, most recently from 2dd4141 to 0e53ce4 Compare June 19, 2023 08:59
@clementmbr
clementmbr force-pushed the 16.0-mig-cron_daylight_saving_time_resistant branch from 0e53ce4 to 86df925 Compare January 24, 2024 12:49

@clementmbr clementmbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clementmbr

Copy link
Copy Markdown
Member

@florian-dacosta @hparfr
FYO, the PR is with green tests now, ready for review!

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@bguillot

Copy link
Copy Markdown
Contributor

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-2578-by-bguillot-bump-nobump, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit 68c9b6d into OCA:16.0 Jan 29, 2024
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 7c431ec. Thanks a lot for contributing to OCA. ❤️

@StefanRijnhart

Copy link
Copy Markdown
Member

This module seems to be causing test failures in recent PRs:

 2024-03-22 11:59:44,139 390 ERROR odoo odoo.addons.cron_daylight_saving_time_resistant.tests.test_dst: ERROR: TestDST.test_cron
Traceback (most recent call last):
  File "/opt/odoo/odoo/sql_db.py", line 176, in __exit__
    self.commit()
  File "/opt/odoo/odoo/sql_db.py", line 558, in commit
    self._savepoint.close(rollback=False)
  File "/opt/odoo/odoo/sql_db.py", line 86, in close
    self._close(rollback)
  File "/opt/odoo/odoo/sql_db.py", line 94, in _close
    self._cr.execute(SQL('RELEASE SAVEPOINT {}').format(self._name))
  File "/opt/odoo/odoo/sql_db.py", line 321, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.InvalidSavepointSpecification: savepoint "13b0b903-3992-11ec-965e-5f38e53695a9" does not exist


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/__w/server-tools/server-tools/cron_daylight_saving_time_resistant/tests/test_dst.py", line 71, in test_cron
    self._check_cron_date_after_run(cron, "2021-10-30 15:00:00")
  File "/__w/server-tools/server-tools/cron_daylight_saving_time_resistant/tests/test_dst.py", line 43, in _check_cron_date_after_run
    registry["ir.cron"]._process_job(db, new_cr, job)
  File "/__w/server-tools/server-tools/cron_daylight_saving_time_resistant/models/ir_cron.py", line 48, in _process_job
    with cls.pool.cursor() as job_cr:
  File "/opt/odoo/odoo/sql_db.py", line 178, in __exit__
    self.close()
  File "/opt/odoo/odoo/sql_db.py", line 540, in close
    self.rollback()
  File "/opt/odoo/odoo/sql_db.py", line 571, in rollback
    self._savepoint.rollback()
  File "/opt/odoo/odoo/sql_db.py", line 89, in rollback
    self._cr.execute(SQL('ROLLBACK TO SAVEPOINT {}').format(self._name))
  File "/opt/odoo/odoo/sql_db.py", line 321, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.InvalidSavepointSpecification: savepoint "13b0b903-3992-11ec-965e-5f38e53695a9" does not exist

https://github.com/OCA/server-tools/actions/runs/8389895772/job/22977050191?pr=2887

Would you be so kind as to have a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants