Odoo Help

On 3/14/13, 7:06 AM

You can use a fields.function with type='char'. The function to compute this field will give the fields.text value and truncate it.

Then, in the tree view, if you want the whole text, you display the fields.text otherwise, display the fields.function.

Hi, thanks for the trick. it's a good work around if you are not willing to have inline editing (e.i. editable="bottom"). Because we can't have an editable function field.

HIGHCO - Nicolas Clavier
on 3/19/13, 6:17 AM

This is not true, you can define the parameter fnct_inv to create the write method of function field. However, in your case I agree that it wouldn't be conveniant as you would need a truncated field only in view mode and a full text in edit mode. A widget might be the best choice.

Camptocamp SA
on 3/19/13, 8:37 AM

I stumbled upon fnct_inv this morning to find that out .. how do you mean "a widget" .. writing a widget ?

HIGHCO - Nicolas Clavier
on 3/19/13, 10:12 AM

Yes it is what I meant. Creating a widget that extends the base text widget and hides parts of the text only in view mode.

Camptocamp SA
on 3/20/13, 8:58 AM

I'm ok to get into writing widgets but have no time for now. Would it be complex ? Any link examples / repo ?

HIGHCO - Nicolas Clavier
on 3/20/13, 10:32 AM

I'm marking this answer as a solution because in the end it's the only quick way to achieve this. Except that the list view won't be editable inline. I'll show the function field inline, and the original text field in the form. Thank @all

HIGHCO - Nicolas Clavier
on 3/20/13, 10:35 AM

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--

| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/18/13, 7:39 PM

Hi, there is a function which do that in 6.0, function truncate_data, you can find it here :


update with new informations given by comment after :

if you can have status of the page, editable or browse, you can use function I gave before :

create a new field text which is updated by onchange with first you are already created.

in tree view in function of state of the page (editable or browse), one is visible, the second no.


Hi, thanks for pointing this out to me but the idea here is to have a text field that can be fully edited inline, and that only shows so many characters when in browse mode. If the behavior doesn't exist, I'll post a feedback on http://feedback.openerp.com. These features are lacking, along with placeholders, rich text, etc.

HIGHCO - Nicolas Clavier
on 3/19/13, 6:27 AM

I update my answer

Cyril Gaspard (GEM)
on 3/19/13, 6:50 AM

ok, sounds like the answer I was looking for. Still have to detect the field/view state, any hint ? is it a variable available in xml (a bit like active_id, parent, etc) ?

HIGHCO - Nicolas Clavier
on 3/19/13, 10:02 AM

I can't find in the view the boolean context variable set_editable mentioned here : http://doc.openerp.com/trunk/developers/web/list_view/#editability-status

HIGHCO - Nicolas Clavier
on 3/19/13, 10:23 AM

I believe you do not understood what I would say by editable/browse. Editable is when you push a button create or edit, browse is a view in state read (I wanted just use terms you used yourself). By regarding your other new questions, attribute set_editable is to have a tree with lines editable without wizard form opened to modify value of fields, this is not the same thing. I do not if it is possible to have the status edit/read mode of a view. bye

Cyril Gaspard (GEM)
on 3/19/13, 7:58 PM

Hi GEM, thanks for coming back to me. I understand both contexts are different. The link above discusses a javascript context accessed from the client side which could as well be a completely different context from the server side context. I created a new question to dig and clarify this topic.

HIGHCO - Nicolas Clavier
on 3/20/13, 5:28 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/14/13, 6:57 AM
Seen: 7498 times
Last updated: 4/15/16, 10:45 AM