User is not warned when data filled in is too long. Field's size should impact its validity.

Bug #956582 reported by Cristian Salamea
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Web Team

Bug Description

Size value for char fields does not works.
With revno 2275

Test:

Fresh installation with 6.1 branches install stock module.
Open a product
write in ref, w/o limit
write in name 2/limit, here if you pass 128 (defined in product), server gives the error.

This is an UI error in Web client.

I dont know if any one test this but IMO this kind of errors is unacceptable.

Regards,

******
Error Server

Server Traceback (most recent call last):
  File "/Users/ovnicraft/development/openerp/61/web-client/addons/web/common/http.py", line 592, in send
    result = openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/service/web_services.py", line 572, in dispatch
    res = fn(db, uid, *params)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/Users/ovnicraft/development/openerp/61/server/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/osv/orm.py", line 4036, in write
    self.pool.get(object)._store_set_values(cr, user, todo, fields_to_recompute, context)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/osv/orm.py", line 4385, in _store_set_values
    '"'+f+'"='+self._columns[f]._symbol_set[0] + ' where id = %s', (self._columns[f]._symbol_set[1](value), id))
  File "/Users/ovnicraft/development/openerp/61/server/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "/Users/ovnicraft/development/openerp/61/server/openerp/sql_db.py", line 212, in execute
    res = self._obj.execute(query, params)
DataError: value too long for type character varying(128)

Tags: maintenance

Related branches

Changed in openerp-web:
importance: Medium → Critical
Changed in openerp-web:
importance: Critical → Medium
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hi,

This looks like an annoying bug indeed, but not a complete showstopper, as the workaround is very simple: enter a shorter value in the field (even if that may not be obvious to end-users based on the error). Therefore it seems to me that the bug cannot be considered Critical, but rather Medium or High.

Thanks!

PS: Please don't confirm or change the importance of your own bug reports. That would be like approving your own merge proposals. As a member of OpenERP Drivers, if you are unsure about the meaning of bug importance values, you really must read and understand our bug management guidelines in the documentation: http://doc.openerp.com/v6.0/contribute/11_bug_tracker.html#definition-of-a-bug

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Using a database with all modules installed on runbot, I can't reproduce the error you are mentioning on the description. The behavior I see is that the value is trimmed at the limit silently, so the user may not notice that a part of the input was cut, but that's all. As limits are usually high enough for most uses, Medium seems like an appropriate importance.

Revision history for this message
Fabien Meghazi (OpenERP) (fme) wrote :

Can't reproduce the error neither.

Maybe the client should mark fields as invalid when data filled in is greater than defined size.

Changed in openerp-web:
importance: Medium → Wishlist
summary: - size param in char field does not works
+ User is not warned when data filled in is too long. Field's size should
+ impact its validity.
Revision history for this message
Cristian Salamea (ovnicraft) wrote :

Thanks Olivier, yes the value is trimmed silently, users needs to feel the limit in fields.

Regards,

Revision history for this message
Cristian Salamea (ovnicraft) wrote :

Hello Fabien, so you can reproduce it ?.

Client must limit the input, its important think in preventive way not in corrective way.

Regards,

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote : Re: [Bug 956582] Re: size param in char field does not works

On 03/28/2012 02:20 PM, Fabien Meghazi (OpenERP) wrote:
> Maybe the client should mark fields as invalid when data filled in is
> greater than defined size.

Yes, it must do that, or explicitly prevent entering more characters in an
input/textarea than allowed by the corresponding size attribute, as was the
case in previous OpenERP clients (and in the GTK).
Watch out that there are cases where a widget=text is used on a fields.char and
other cases where widget=char is used on a fields.text. So it's better to make
the support generic in both widgets, independently of the actual field type.

The HTML 5 maxlength attribute seems to fit the bill, although I didn't check
current browser support.

This is important:

- when a module wants to limit the size of an field for a functional reason,
the client must verify it. This has always worked on all OpenERP clients

- silently trimming the input is worse than raising an error because the
end-user may lose valuable data without knowing it (the server side silently
slices the values before saving them in the database as a final sanity-check).
Such values must be caught client-side as part of the field validation.

Changed in openerp-web:
importance: Wishlist → Medium
Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello,

This has been fixed in lp:~openerp-dev/openerp-web/6.1-opw-573377-msh.

Thanks.

tags: added: maintenance
Changed in openerp-web:
status: Confirmed → Fix Committed
Revision history for this message
Fabien Meghazi (OpenERP) (fme) wrote :

Fixed in Revision:
2306 revid:<email address hidden>

Changed in openerp-web:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.