# Not show string when widget has url and is a function field

**URL:** https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316
**Category:** Developer
**Created:** [June 14, 2021, 7:58am UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316 "2021-06-14T07:58:07Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![resteve](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/resteve/32/823_2.png) [@resteve](https://discuss.tryton.org/u/resteve)
#### Post date: [June 14, 2021, 7:58am UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/1 "2021-06-14T07:58:08Z")

</div>

Hie,

When a function field has “url” attribute defined in XML, not show the value (string) (only the icon).  
In case in a function field, add the setter, in this case show icon and the value (string).

Why not show value content a function field without setter and url attribute?

I attach an image. Phone is a function field:

```python
    app_phone = fields.Function(fields.Char('Phone'), 'get_app_mechanism')

    def get_app_mechanism(self, name):
        ctype = 'tel' if name[4:] == 'phone' else 'mailto'
        if self.value and self.type == name[4:]:
            return self.value
            # return '%s:%s' % (ctype, self.value)
        return ''

```

 ![function-widget-url-2](https://discuss-cdn.tryton.org/uploads/default/original/2X/9/99ea6d3b2438dacd03c6e093a66e03e74ba52305.png)

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [June 14, 2021, 8:48am UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/2 "2021-06-14T08:48:44Z")

</div>

This is strange behaviour, adding a setter should not change how the field is show on a list bit. Probably the diference between both is that the setter makes the readonly definition of the field set to false.

Does the tryton client have the same behaviour as sao?

---

<div class="post-metadata">

### Author: ![resteve](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/resteve/32/823_2.png) [@resteve](https://discuss.tryton.org/u/resteve)
#### Post date: [June 14, 2021, 11:03am UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/3 "2021-06-14T11:03:39Z")

</div>

> [@pokoli](#):
>
> Does the tryton client have the same behaviour as sao?

GTK same as SAO

 ![gtk-function-url](https://discuss-cdn.tryton.org/uploads/default/original/2X/3/30354ea8542c16360b5590ee16419c3f82a875f6.png)

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [June 14, 2021, 12:06pm UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/4 "2021-06-14T12:06:41Z")

</div>

This is the expected behavior. When the field is readonly we do not display the input and we display it when it is not readonly.

---

<div class="post-metadata">

### Author: ![dave](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/d/ee7513/32.png) [@dave](https://discuss.tryton.org/u/dave)
#### Post date: [June 14, 2021, 12:26pm UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/5 "2021-06-14T12:26:45Z")

</div>

Just for the record, this is similar to a question I asked a while back: [Why are email fields hidden on deactivated records?](https://discuss.tryton.org/t/why-are-email-fields-hidden-on-deactivated-records/2849)

---

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [June 14, 2021, 3:52pm UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/6 "2021-06-14T15:52:57Z")

</div>

> [@ced](#):
>
> This is the expected behavior. When the field is readonly we do not display the input and we display it when it is not readonly.

Is there a good reason for that? Doesn’t seem most people (including myself) find it like the expected or desirable behaviour.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [June 14, 2021, 4:04pm UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/7 "2021-06-14T16:04:15Z")

</div>

Why showing complex and long URL that the user can not edit but only click on it?  
The goal is to simplify the UI.

---

<div class="post-metadata">

### Author: ![resteve](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/resteve/32/823_2.png) [@resteve](https://discuss.tryton.org/u/resteve)
#### Post date: [June 15, 2021, 7:28am UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/8 "2021-06-15T07:28:02Z")

</div>

> [@ced](#):
>
> The goal is to simplify the UI.

1. User don’t know in tree view that url icon has or not a valued (an url).
2. Email and phone the url are short. Example: [mailto:hello@tryton.org](mailto:hello@tryton.org)
3. A long url, could slide some characters. Example: [https://discuss.tryton.org/t/not-s](https://discuss.tryton.org/t/not-s)…

Also I don’t understand that tree view is not editable and function field not show the valued except when has a setter method.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [June 15, 2021, 8:02am UTC](https://discuss.tryton.org/t/not-show-string-when-widget-has-url-and-is-a-function-field/4316/9 "2021-06-15T08:02:47Z")

</div>

> [@resteve](#):
>
> User don’t know in tree view that url icon has or not a valued (an url).

Make a patch to improve the display of the icon

> [@resteve](#):
>
> Also I don’t understand that tree view is not editable and function field not show the valued except when has a setter method.

Make a patch to not show the content on non editable tree view.
