Comment 1 for bug 1053511

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello,

This issue is more straightforward than the actual bug report.

It is very simple to reproduce:
 - Go to 'Settings > Customization > Database Structure > Fields'
 - Create a new field on any model with a 'text' field type
 -> You'll notice that: you can't change the size of the field

The default size of the field is 64, and can't be changed.

So the client just does what the server told it to do: it display a text widget with a length of 64 characters.

The size should certainly not be defined on 'text' fields (the size of the text fields created by the ORM is NULL).

Another thing, if I try to create a 'text' field directly with a python 'create' in ir.model.data and I put the 'size' key to False, the creation will fail. Because the ORM will put a 0 instead of a False (it goes like that with int), and the following constraint of ir.model.fields will be raised.

    def _size_gt_zero_msg(self, cr, user, ids, context=None):
        return _('Size of the field can never be less than 1 !')

    _sql_constraints = [
        ('size_gt_zero', 'CHECK (size>0)',_size_gt_zero_msg ),
    ]