dynamical text fields have size=64 when show dynamically in a view
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Released
|
Low
|
OpenERP Publisher's Warranty Team |
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:
For this field, the method answers :
However, if I call the same method for a native text field like "description" (in product.template), I get :
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
Related branches
- OpenERP Core Team: Pending requested
- Diff: 0 lines
- Pedro Manuel Baeza: Approve (code review)
- Stefan Rijnhart (Opener): Approve
-
Diff: 50 lines (+4/-5)3 files modifiedopenerp/addons/base/ir/ir.xml (+1/-1)
openerp/addons/base/ir/ir_model.py (+2/-3)
openerp/osv/orm.py (+1/-1)
Changed in openobject-server: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |
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 ),
]