← Back to team overview

openerp-india team mailing list archive

[Bug 1053511] Re: dynamical text fields have size=64 when show dynamically in a view

 

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 ),
    ]

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1053511

Title:
  dynamical text fields have size=64 when show dynamically in a view

Status in OpenERP Server:
  New

Bug description:
  Hello,

  I have created a field dynamically. It's type is : "text". Let's call
  it : "x_text_field".

  Then I have overriden the method fields_view_get() in order to show it dynamically. 
  So, in the method to update the fields of the view, I call the method fields_get() like this:

          result['fields'].update(self.fields_get(cr, uid,
  ['x_text_field'], context=context))

  For this field, the method answers :

         {u'x_text_field': {'selectable': True, 'translate': True,
  'type': 'text', 'string': u'text_field', 'size': 64}}

  However, if I call the same method for a native text field like
  "description" (in product.template), I get :

         {'description': {'selectable': True, 'translate': True, 'type':
  'text', 'string': 'Description'}}

  Then, on the view (only the one that adds dynamically the field), the
  size of the field 'text_field' is limited to 64 chars, even if in the
  database the size isn't limited.

  To make it more complicated, this bug seems to appear only with the
  web client, because the web client authorizes the size limitation of
  the fields of type "text" and not the gtk client. So, even if the
  answer of the method fields_get() is wrong, with the gtk client it is
  not considered.

  Best regards,

  Benoît

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1053511/+subscriptions


References