c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #04420
[Bug 675693] Re: Error 'Invalid datetime format' in Delivery Orders > Stock Moves (/search/eval_domain_and_context)
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
154,158c154
< try:
< res = time.strptime(value, '%Y-%m-%d %H:%M:%S')
< 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 :-)
--
Error 'Invalid datetime format' in Delivery Orders > Stock Moves (/search/eval_domain_and_context)
https://bugs.launchpad.net/bugs/675693
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
Status in OpenObject Web Client: New
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/date_planned. Seems to be a Javascript error:
--------8<-------
_terp_active_id False
_terp_active_ids []
_terp_context location=location_id
_terp_domain []
_terp_parent_context {}
_terp_prefix move_lines
active {"value":"1", "type":"boolean"}
address_id {"value":"", "type":"many2one", "relation":"res.partner.address"}
auto_picking {"value":"", "type":"boolean"}
backorder_id {"value":"", "type":"many2one", "relation":"stock.picking"}
carrier_id {"value":"", "type":"many2one", "relation":"delivery.carrier"}
date {"value":"2010-11-16 9:00:00", "type":"datetime"}
date_done {"value":"", "type":"datetime"}
invoice_type_id {"value":"", "type":"many2one", "relation":"sale_journal.invoice.type"}
journal_id {"value":"", "type":"many2one", "relation":"sale_journal.picking.journal"}
min_date {"value":"11/16/2010 09:00:00", "type":"datetime"}
move_lines/__id
move_lines/date {"value":"11/15/2010 19:54:52", "type":"datetime"}
move_lines/date_planned {"value":"11/15/2010 19:54:52", "type":"datetime"}
move_lines/location_dest_... {"value":"", "type":"many2one", "relation":"stock.location"}
move_lines/location_id {"value":"", "type":"many2one", "relation":"stock.location"}
move_lines/name {"value":"", "type":"char"}
move_lines/prodlot_id {"value":"", "type":"many2one", "relation":"stock.production.lot"}
move_lines/product_id {"value":"", "type":"many2one", "relation":"product.product"}
move_lines/product_packag... {"value":"", "type":"many2one", "relation":"product.packaging"}
move_lines/product_qty {"value":"1.00", "type":"float"}
move_lines/product_uom {"value":"", "type":"many2one", "relation":"product.uom"}
move_lines/product_uos {"value":"", "type":"many2one", "relation":"product.uom"}
move_lines/product_uos_qt... {"value":"", "type":"float"}
move_lines/state {"value":"draft", "type":"char"}
move_lines/tracking_id {"value":"", "type":"many2one", "relation":"stock.tracking"}
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":"sale_journal.sale.journal"}
state {"value":"draft", "type":"char"}
type {"value":"delivery", "type":"char"}
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.
References