Error 'Invalid datetime format' in Delivery Orders > Stock Moves (/search/eval_domain_and_context)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Web Client |
Fix Released
|
Medium
|
OpenERP R&D Web Team |
Bug Description
We get an "Invalid datetime format" Error as in the following JSON reply:
--------8<-------
{"error_field": "date", "error": "Invalid datetime format"}
--------8<-------
This was our request, as you may notice the POST field "date" uses a different datetime format than min_date, move_lines/date and move_lines/
--------8<-------
_terp_active_id False
_terp_active_ids []
_terp_context location=
_terp_domain []
_terp_parent_
_terp_prefix move_lines
active {"value":"1", "type":"boolean"}
address_id {"value":"", "type":"many2one", "relation"
auto_picking {"value":"", "type":"boolean"}
backorder_id {"value":"", "type":"many2one", "relation"
carrier_id {"value":"", "type":"many2one", "relation"
date {"value"
date_done {"value":"", "type":"datetime"}
invoice_type_id {"value":"", "type":"many2one", "relation"
journal_id {"value":"", "type":"many2one", "relation"
min_date {"value"
move_lines/__id
move_lines/date {"value"
move_lines/
move_lines/
move_lines/
move_lines/name {"value":"", "type":"char"}
move_lines/
move_lines/
move_lines/
move_lines/
move_lines/
move_lines/
move_lines/
move_lines/state {"value":"draft", "type":"char"}
move_lines/
move_type {"value":"direct", "type":"char"}
name {"value":"/", "type":"char"}
note {"value":"", "type":"text"}
origin {"value":"", "type":"char"}
sale_journal_id {"value":"", "type":"many2one", "relation"
state {"value":"draft", "type":"char"}
type {"value"
weight {"value":"", "type":"float"}
--------8<-------
For our OpenERP Installation, this problem is critical because it renders our whole business process unusable. This is the first OpenERP installation we have installed, so the problem may be caused by our database. If you need any further information, please feel free to contact me.
Steps to reproduce:
1. "Delivery Orders"
2. Switch to "Calendar" mode
3. Click on a day in the calendar
4. In the popup window, click on "Switch view.." icon belonging to the "General Information" register card.
5. Press the google icon "Search" beside the "Product" field.
6. Javascript error box
We are running both OpenERP Web and OpenERP server on Version 5.0.15 installed via pyeggs on a Debian Etch server with Postgres DB.
Related branches
Changed in openobject-client-web: | |
assignee: | nobody → OpenERP SA's Web Client R&D (openerp-dev-web) |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in openobject-client-web: | |
status: | Confirmed → In Progress |
After a couple of hours spent debugging we came up with the following workaround. It seems that some dates in POST forms are ISO-DateTime encoded (%Y-%m-%d %H:%M:%i, for example 2010-11-30 9:33:11), and the input validation routine in /openerp/ validators/ validators. py doesn't like that and throws the exception.
Unfortunately we didn't find a way to make openerp-web fill the appropriate date fields with a well-formed date string right from the beginning, so we modified the date validation function to accept strings in ISO-DateTime format. I know this is a quick & dirty workaround which could probably cause a couple of problems down the road, but for us it fixed the problem and we were finally able to start using openerp-web.
# diff validators/ validators. py ~/openerp- 5.0.15/ openerp- web-5.0. 15/openerp/ validators/ validators. py value, '%Y-%m-%d %H:%M:%S')
154,158c154
< try:
< res = time.strptime(
< except ValueError:
< raise Invalid(_('Invalid datetime format'), value, state)
<
---
> raise Invalid(_('Invalid datetime format'), value, state)
Anyway, I'm still looking forward for a "real" solution to this problem :-)