Repository: odoo/odoo

Issue #1749: ir_crone astimezone() cannot be applied to a naive datetime
Created: 2014-08-12T13:28:33Z
2014-08-12 13:28:05,651 30983 ERROR DB openerp.addons.base.ir.ir_cron: Unexpected exception while processing cron job {'function': u'power_on', 'create_uid': 1, 'args': u'()', 'user_id': 1, 'name': u'AutoVacuum osv_memory objects', 'interval_type': u'minutes', 'numbercall': -1, 'nextcall': '2014-08-12 13:27:32', 'priority': 5, 'model': u'osv_memory.autovacuum', 'doall': False, 'write_date': '2014-08-12 13:27:22.336041', 'active': True, 'create_date': '2014-08-12 13:27:22.336041', 'interval_number': 30, 'write_uid': 1, 'id': 1}
Traceback (most recent call last):
File "/opt/odoo/server/openerp/addons/base/ir/ir_cron.py", line 251, in _acquire_job
registry[cls._name]._process_job(job_cr, job, lock_cr)
File "/opt/odoo/server/openerp/addons/base/ir/ir_cron.py", line 180, in _process_job
(nextcall.astimezone(pytz.UTC).strftime(DEFAULT_SERVER_DATETIME_FORMAT), numbercall, job['id']))
ValueError: astimezone() cannot be applied to a naive datetime

Duplicate issue #1766: Odoo cron error when installing an instance without demo data.
Created: 2014-08-13T14:36:39Z
For installation, I use the buildout recipe (https://pypi.python.org/pypi/anybox.recipe.openerp/1.8.5).
Odoo version: 8.0
Here are the commands I use used:
$ createdb test
$ bin/start_openerp -d test --db-filter=test --without-demo=ALL
Then, I get this error:
ValueError: astimezone() cannot be applied to a naive datetime
Logs:
2014-08-13 14:32:16,735 1436 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
2014-08-13 14:32:16,803 1436 INFO ? openerp.modules.loading: init db
2014-08-13 14:32:17,964 1436 INFO test openerp.modules.loading: loading 1 modules...
2014-08-13 14:32:18,213 1436 INFO test openerp.modules.module: module base: creating or updating database tables
2014-08-13 14:32:19,412 1436 INFO test openerp.models: Computing parent left and right for table ir_ui_menu...
2014-08-13 14:32:24,219 1436 INFO test openerp.models: Computing parent left and right for table res_partner_category...
2014-08-13 14:32:28,257 1436 INFO test openerp.models: storing computed values of fields.function 'web_icon_data'
2014-08-13 14:32:28,258 1436 INFO test openerp.models: storing computed values of fields.function 'web_icon_hover_data'
2014-08-13 14:32:28,259 1436 INFO test openerp.models: storing computed values of fields.function 'needaction_enabled'
2014-08-13 14:32:28,259 1436 INFO test openerp.models: storing computed values of fields.function 'report_file'
2014-08-13 14:32:28,260 1436 INFO test openerp.models: storing computed values of fields.function 'crud_model_name'
2014-08-13 14:32:28,261 1436 INFO test openerp.models: storing computed values of fields.function 'wkf_model_name'
2014-08-13 14:32:28,262 1436 INFO test openerp.models: storing computed values of fields.function 'global'
2014-08-13 14:32:28,262 1436 INFO test openerp.models: storing computed values of fields.function 'menus_by_module'
2014-08-13 14:32:28,589 1436 INFO test openerp.models: storing computed values of fields.function 'views_by_module'
2014-08-13 14:32:28,770 1436 INFO test openerp.models: storing computed values of fields.function 'reports_by_module'
2014-08-13 14:32:29,007 1436 INFO test openerp.models: storing computed values of fields.function 'display_name'
2014-08-13 14:32:29,015 1436 INFO test openerp.models: storing computed values of fields.function 'image_medium'
2014-08-13 14:32:29,017 1436 INFO test openerp.models: storing computed values of fields.function 'image_small'
2014-08-13 14:32:29,020 1436 INFO test openerp.models: storing computed values of fields.function 'commercial_partner_id'
2014-08-13 14:32:29,023 1436 INFO test openerp.models: storing computed values of fields.function 'logo_web'
2014-08-13 14:32:29,028 1436 INFO test openerp.models: storing computed values of fields.function 'email'
2014-08-13 14:32:29,029 1436 INFO test openerp.models: storing computed values of fields.function 'phone'
2014-08-13 14:32:29,033 1436 INFO test openerp.modules.loading: loading base/base_data.xml
2014-08-13 14:32:29,750 1436 INFO test openerp.modules.loading: loading base/res/res_currency_data.xml
2014-08-13 14:32:34,852 1436 INFO test openerp.modules.loading: loading base/res/res_country_data.xml
2014-08-13 14:32:37,219 1436 INFO test openerp.modules.loading: loading base/security/base_security.xml
2014-08-13 14:32:37,464 1436 INFO test openerp.modules.loading: loading base/base_menu.xml
2014-08-13 14:32:37,785 1436 INFO test openerp.modules.loading: loading base/res/res_config.xml
2014-08-13 14:32:37,848 1436 INFO test openerp.modules.loading: loading base/res/res.country.state.csv
2014-08-13 14:32:38,116 1436 INFO test openerp.modules.loading: loading base/ir/ir_actions.xml
2014-08-13 14:32:38,737 1436 INFO test openerp.modules.loading: loading base/ir/ir_config_parameter_view.xml
2014-08-13 14:32:38,837 1436 INFO test openerp.modules.loading: loading base/ir/ir_cron_view.xml
2014-08-13 14:32:38,986 1436 INFO test openerp.modules.loading: loading base/ir/ir_filters.xml
2014-08-13 14:32:39,120 1436 INFO test openerp.modules.loading: loading base/ir/ir_mail_server_view.xml
2014-08-13 14:32:39,225 1436 INFO test openerp.modules.loading: loading base/ir/ir_model_view.xml
2014-08-13 14:32:39,843 1436 INFO test openerp.modules.loading: loading base/ir/ir_attachment_view.xml
2014-08-13 14:32:39,949 1436 INFO test openerp.modules.loading: loading base/ir/ir_rule_view.xml
2014-08-13 14:32:40,066 1436 INFO test openerp.modules.loading: loading base/ir/ir_sequence_view.xml
2014-08-13 14:32:40,253 1436 INFO test openerp.modules.loading: loading base/ir/ir_translation_view.xml
2014-08-13 14:32:40,352 1436 INFO test openerp.modules.loading: loading base/ir/ir_ui_menu_view.xml
2014-08-13 14:32:40,449 1436 INFO test openerp.modules.loading: loading base/ir/ir_ui_view_view.xml
2014-08-13 14:32:40,625 1436 INFO test openerp.modules.loading: loading base/ir/ir_values_view.xml
2014-08-13 14:32:40,799 1436 INFO test openerp.modules.loading: loading base/ir/osv_memory_autovacuum.xml
2014-08-13 14:32:40,814 1436 INFO test openerp.modules.loading: loading base/ir/ir_model_report.xml
2014-08-13 14:32:40,841 1436 INFO test openerp.modules.loading: loading base/ir/ir_logging_view.xml
2014-08-13 14:32:40,950 1436 INFO test openerp.modules.loading: loading base/ir/ir_qweb.xml
2014-08-13 14:32:40,975 1436 INFO test openerp.modules.loading: loading base/workflow/workflow_view.xml
2014-08-13 14:32:41,406 1436 INFO test openerp.modules.loading: loading base/module/module_view.xml
2014-08-13 14:32:41,621 1436 INFO test openerp.modules.loading: loading base/module/module_data.xml
2014-08-13 14:32:41,733 1436 INFO test openerp.modules.loading: loading base/module/module_report.xml
2014-08-13 14:32:41,751 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_module_update_view.xml
2014-08-13 14:32:41,825 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_language_install_view.xml
2014-08-13 14:32:41,892 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_import_language_view.xml
2014-08-13 14:32:41,956 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_module_upgrade_view.xml
2014-08-13 14:32:42,044 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_module_configuration_view.xml
2014-08-13 14:32:42,067 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_export_language_view.xml
2014-08-13 14:32:42,129 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_update_translations_view.xml
2014-08-13 14:32:42,190 1436 INFO test openerp.modules.loading: loading base/module/wizard/base_module_immediate_install.xml
2014-08-13 14:32:42,229 1436 INFO test openerp.modules.loading: loading base/res/res_company_view.xml
2014-08-13 14:32:42,450 1436 INFO test openerp.modules.loading: loading base/res/res_request_view.xml
2014-08-13 14:32:42,549 1436 INFO test openerp.modules.loading: loading base/res/res_lang_view.xml
2014-08-13 14:32:42,652 1436 INFO test openerp.modules.loading: loading base/res/res_partner_report.xml
2014-08-13 14:32:42,672 1436 INFO test openerp.modules.loading: loading base/res/res_partner_view.xml
2014-08-13 14:32:43,096 1436 INFO test openerp.modules.loading: loading base/res/res_bank_view.xml
2014-08-13 14:32:43,313 1436 INFO test openerp.modules.loading: loading base/res/res_country_view.xml
2014-08-13 14:32:43,526 1436 INFO test openerp.modules.loading: loading base/res/res_currency_view.xml
2014-08-13 14:32:43,630 1436 INFO test openerp.modules.loading: loading base/res/res_users_view.xml
2014-08-13 14:32:44,000 1436 INFO test openerp.modules.loading: loading base/res/res_partner_data.xml
2014-08-13 14:32:44,072 1436 INFO test openerp.modules.loading: loading base/res/ir_property_view.xml
2014-08-13 14:32:44,179 1436 INFO test openerp.modules.loading: loading base/res/res_security.xml
2014-08-13 14:32:44,286 1436 INFO test openerp.modules.loading: loading base/security/ir.model.access.csv
2014-08-13 14:32:46,749 1436 INFO test openerp.modules.loading: 1 modules loaded in 28.78s, 0 queries
2014-08-13 14:32:46,755 1436 INFO test openerp.addons.base.ir.ir_translation: module base: loading translation file (fr) for language fr_FR
2014-08-13 14:32:46,755 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/openerp/addons/base/i18n/fr.po
2014-08-13 14:32:47,571 1436 INFO test openerp.modules.loading: updating modules list
2014-08-13 14:32:48,428 1436 INFO ? openerp.addons.bus.bus: Bus.loop listen imbus on db postgres
2014-08-13 14:32:49,465 1436 INFO test openerp.addons.report.models.report: Upgrade wkhtmltopdf to (at least) 0.12.0
2014-08-13 14:32:49,745 1436 INFO test openerp.http: HTTP Configuring static files
2014-08-13 14:32:51,869 1436 INFO test openerp.modules.loading: loading 1 modules...
2014-08-13 14:32:51,937 1436 INFO test openerp.modules.loading: 1 modules loaded in 0.07s, 0 queries
2014-08-13 14:32:52,149 1436 INFO test openerp.modules.loading: loading 12 modules...
2014-08-13 14:32:52,192 1436 INFO test openerp.modules.module: module web: creating or updating database tables
2014-08-13 14:32:52,199 1436 INFO test openerp.modules.loading: loading web/views/webclient_templates.xml
2014-08-13 14:32:52,978 1436 INFO test openerp.addons.base.ir.ir_translation: module web: loading translation file (fr) for language fr_FR
2014-08-13 14:32:52,978 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/web/i18n/fr.po
2014-08-13 14:32:53,203 1436 INFO test openerp.modules.module: module base_import: creating or updating database tables
2014-08-13 14:32:53,959 1436 INFO test openerp.modules.loading: loading base_import/security/ir.model.access.csv
2014-08-13 14:32:54,197 1436 INFO test openerp.modules.loading: loading base_import/views/base_import.xml
2014-08-13 14:32:54,341 1436 INFO test openerp.addons.base.ir.ir_translation: module base_import: loading translation file (fr) for language fr_FR
2014-08-13 14:32:54,342 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/base_import/i18n/fr.po
2014-08-13 14:32:54,541 1436 INFO test openerp.modules.module: module report: creating or updating database tables
2014-08-13 14:32:54,963 1436 INFO test openerp.modules.loading: loading report/views/layouts.xml
2014-08-13 14:32:55,293 1436 INFO test openerp.modules.loading: loading report/views/views.xml
2014-08-13 14:32:55,641 1436 INFO test openerp.modules.loading: loading report/data/report_paperformat.xml
2014-08-13 14:32:55,688 1436 INFO test openerp.modules.loading: loading report/security/ir.model.access.csv
2014-08-13 14:32:55,760 1436 INFO test openerp.modules.loading: loading report/views/report.xml
2014-08-13 14:32:56,136 1436 WARNING test openerp.addons.base.ir.ir_translation: module report: no translation for language fr
2014-08-13 14:32:56,197 1436 INFO test openerp.modules.module: module web_calendar: creating or updating database tables
2014-08-13 14:32:56,210 1436 INFO test openerp.modules.loading: loading web_calendar/views/web_calendar.xml
2014-08-13 14:32:56,346 1436 INFO test openerp.addons.base.ir.ir_translation: module web_calendar: loading translation file (fr) for language fr_FR
2014-08-13 14:32:56,347 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/web_calendar/i18n/fr.po
2014-08-13 14:32:56,431 1436 INFO test openerp.modules.module: module web_diagram: creating or updating database tables
2014-08-13 14:32:56,434 1436 INFO test openerp.modules.loading: loading web_diagram/views/web_diagram.xml
2014-08-13 14:32:56,612 1436 INFO test openerp.addons.base.ir.ir_translation: module web_diagram: loading translation file (fr) for language fr_FR
2014-08-13 14:32:56,613 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/web_diagram/i18n/fr.po
2014-08-13 14:32:56,683 1436 INFO test openerp.modules.module: module web_gantt: creating or updating database tables
2014-08-13 14:32:56,687 1436 INFO test openerp.modules.loading: loading web_gantt/views/web_gantt.xml
2014-08-13 14:32:56,798 1436 INFO test openerp.addons.base.ir.ir_translation: module web_gantt: loading translation file (fr) for language fr_FR
2014-08-13 14:32:56,799 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/web_gantt/i18n/fr.po
2014-08-13 14:32:56,862 1436 INFO test openerp.modules.module: module web_graph: creating or updating database tables
2014-08-13 14:32:56,867 1436 INFO test openerp.modules.loading: loading web_graph/views/web_graph.xml
2014-08-13 14:32:56,988 1436 INFO test openerp.addons.base.ir.ir_translation: module web_graph: loading translation file (fr) for language fr_FR
2014-08-13 14:32:56,989 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/web_graph/i18n/fr.po
2014-08-13 14:32:57,060 1436 INFO test openerp.modules.module: module web_kanban: creating or updating database tables
2014-08-13 14:32:57,063 1436 INFO test openerp.modules.loading: loading web_kanban/views/web_kanban.xml
2014-08-13 14:32:57,187 1436 INFO test openerp.addons.base.ir.ir_translation: module web_kanban: loading translation file (fr) for language fr_FR
2014-08-13 14:32:57,187 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/web_kanban/i18n/fr.po
2014-08-13 14:32:57,256 1436 INFO test openerp.modules.module: module web_view_editor: creating or updating database tables
2014-08-13 14:32:57,260 1436 INFO test openerp.modules.loading: loading web_view_editor/views/web_view_editor.xml
2014-08-13 14:32:57,389 1436 INFO test openerp.addons.base.ir.ir_translation: module web_view_editor: loading translation file (fr) for language fr_FR
2014-08-13 14:32:57,389 1436 INFO test openerp.tools.translate: loading /home/clovis/Documents/apf_buildout/parts/odoo/addons/web_view_editor/i18n/fr.po
2014-08-13 14:32:57,462 1436 INFO test openerp.modules.module: module web_kanban_gauge: creating or updating database tables
2014-08-13 14:32:57,466 1436 INFO test openerp.modules.loading: loading web_kanban_gauge/views/web_kanban_gauge.xml
2014-08-13 14:32:57,599 1436 WARNING test openerp.addons.base.ir.ir_translation: module web_kanban_gauge: no translation for language fr
2014-08-13 14:32:57,651 1436 INFO test openerp.modules.module: module web_tests: creating or updating database tables
2014-08-13 14:32:57,656 1436 INFO test openerp.modules.loading: loading web_tests/views/web_tests.xml
2014-08-13 14:32:57,894 1436 WARNING test openerp.addons.base.ir.ir_translation: module web_tests: no translation for language fr
2014-08-13 14:32:57,939 1436 INFO test openerp.modules.loading: 12 modules loaded in 5.79s, 0 queries
2014-08-13 14:32:57,943 1436 INFO test openerp.modules.loading: loading 12 modules...
2014-08-13 14:32:57,991 1436 INFO test openerp.modules.loading: 12 modules loaded in 0.05s, 0 queries
2014-08-13 14:32:57,998 1436 INFO test openerp.modules.loading: loading 12 modules...
2014-08-13 14:32:58,095 1436 INFO test openerp.modules.loading: 12 modules loaded in 0.09s, 0 queries
2014-08-13 14:32:58,099 1436 INFO test openerp.modules.loading: loading 12 modules...
2014-08-13 14:32:58,189 1436 INFO test openerp.modules.loading: 12 modules loaded in 0.09s, 0 queries
2014-08-13 14:32:58,600 1436 INFO test openerp.modules.loading: Modules loaded.
2014-08-13 14:32:58,604 1436 INFO test openerp.models: Computing parent left and right for table ir_ui_menu...
2014-08-13 14:33:16,843 1436 ERROR test openerp.addons.base.ir.ir_cron: Unexpected exception while processing cron job {'function': u'power_on', 'create_uid': 1, 'args': u'()', 'user_id': 1, 'name': u'AutoVacuum osv_memory objects', 'interval_type': u'minutes', 'numbercall': -1, 'nextcall': '2014-08-13 14:32:40', 'priority': 5, 'model': u'osv_memory.autovacuum', 'doall': False, 'write_date': '2014-08-13 14:32:29.047315', 'active': True, 'create_date': '2014-08-13 14:32:29.047315', 'interval_number': 30, 'write_uid': 1, 'id': 1}
Traceback (most recent call last):
File "/home/clovis/Documents/apf_buildout/parts/odoo/openerp/addons/base/ir/ir_cron.py", line 251, in _acquire_job
registry[cls._name]._process_job(job_cr, job, lock_cr)
File "/home/clovis/Documents/apf_buildout/parts/odoo/openerp/addons/base/ir/ir_cron.py", line 180, in _process_job
(nextcall.astimezone(pytz.UTC).strftime(DEFAULT_SERVER_DATETIME_FORMAT), numbercall, job['id']))
ValueError: astimezone() cannot be applied to a naive datetime
2014-08-13 14:33:17,815 1436 ERROR test openerp.addons.base.ir.ir_cron: Unexpected exception while processing cron job {'function': u'power_on', 'create_uid': 1, 'args': u'()', 'user_id': 1, 'name': u'AutoVacuum osv_memory objects', 'interval_type': u'minutes', 'numbercall': -1, 'nextcall': '2014-08-13 14:32:40', 'priority': 5, 'model': u'osv_memory.autovacuum', 'doall': False, 'write_date': '2014-08-13 14:32:29.047315', 'active': True, 'create_date': '2014-08-13 14:32:29.047315', 'interval_number': 30, 'write_uid': 1, 'id': 1}
Traceback (most recent call last):
File "/home/clovis/Documents/apf_buildout/parts/odoo/openerp/addons/base/ir/ir_cron.py", line 251, in _acquire_job
registry[cls._name]._process_job(job_cr, job, lock_cr)
File "/home/clovis/Documents/apf_buildout/parts/odoo/openerp/addons/base/ir/ir_cron.py", line 180, in _process_job
(nextcall.astimezone(pytz.UTC).strftime(DEFAULT_SERVER_DATETIME_FORMAT), numbercall, job['id']))
ValueError: astimezone() cannot be applied to a naive datetime

Closing comment (2014-08-14T01:26:45Z): Hi,
Thanks for the detailed report. This is a duplicate of #1749
Indeed it happened when the admin user had no timezone set. This is fixed by 7f88681 in 7.0, and has been forward-ported to 8.0 already. Please update to the latest source from git.
Thanks for reporting.