Needs review
Project:
Odoo / OpenERP Proxy API
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
20 Feb 2011 at 17:18 UTC
Updated:
26 Feb 2011 at 01:07 UTC
Hi there,
I've started to play with this great module and I've found some minor errors and warnings while trying to configure it. Attached is a patch with some fixes.
Note I've changed lines as form_set_error('erp-passwd', '...') to form_error($form['user']['erp-passwd'], '..');.
form_set_error was not working (first param should be some as 'user][erp-passwd' (sic). form_error() is a wrapper to set this errors without a headache :)
There're some other things in the code to improve but I didn't want to spam you with a big patch. I can continue providing patches if you're receptive.
| Comment | File | Size | Author |
|---|---|---|---|
| openerp_fixes.patch | 6.17 KB | jonhattan |
Comments
Comment #1
BoogieBug commentedHi!
Thanks for your contribution. I've partially applied your patch into the HEAD version. The exceptions are the form_set_error related issues which are seemingly not really about the form_set_error() function itself but the mis-validation in the code.
Please feel free to submit me any patch you see fit.
rgds.
Comment #2
jonhattanLet me explain it:
when you group form items as in
to set an error on this form item, you need
form_set_error('openerp][erp-passwd', 'error msg'). This way the item with a validation error will be highlighted in red.An alternative to this unfriendly syntax is to use
form_error($form['openerp']['erp-passwd'], 'error msg')http://api.drupal.org/api/drupal/includes--form.inc/function/form_error/6
Comment #3
BoogieBug commentedAccording to the form_set_error documentation, I understand that the form_set_error does not need the name parameter in the format you mentioned, unless the #parents property is set.
In our case the #parents of the $form is not set and the form element name is unique. In addition, it works correctly on my test environment. Unless you found any additional error on this, would you mind if I'd like to keep the current code, due to lack of additional effort, required by the testing.