# Allow the form view to emit informative popup messages

**URL:** https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611
**Category:** Ideas
**Created:** [September 10, 2021, 10:57pm UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611 "2021-09-10T22:57:51Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![numaelis](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/n/9de053/32.png) [@numaelis](https://discuss.tryton.org/u/numaelis)
#### Post date: [September 10, 2021, 10:57pm UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/1 "2021-09-10T22:57:51Z")

</div>

Hi Guys!,

My idea is to allow the form view to emit informative popup messages to the on\_change event …  
summarizing: that while the fields are edited in the form, informative messages can be generated.  
maybe you could add a text-function field to the ModelView class, example self._message\_on\_change  
and that in the client form if ("_ message\_on\_change") {show (info)}

---

<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: [September 10, 2021, 11:10pm UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/2 "2021-09-10T23:10:54Z")

</div>

Which kind of message do you want to show?

You can have hidden labels (or even fields) that are shown on a condition which is triggered by on\_change 😏

Also, we have Error messages (and even warnings) to show them to the user.

I will be against adding more messages without a proper usage rational.

---

<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: [September 11, 2021, 6:15am UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/3 "2021-09-11T06:15:11Z")

</div>

I could see some use case like warning the user who is filling a sale order that the product select is low on stock, or the customer has credit etc.

I do not think we should encourage the message function field with on\_change\_with because it will computed each time when such messages are only when entering data and it will not be different enough in the rendering than a normal field.  
Instead we could use the message notification that client already has (like when record is saved) and have a dedicated method (decorated by `fields.depends`) that the client will call each time one of the dependencies are modified. It returns a text that is display like a message notification until the user does an action that remove it.

---

<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: [September 11, 2021, 6:24am UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/4 "2021-09-11T06:24:09Z")

</div>

Also another way would be to use the bus notification which is probably less intrusive (but does not work on Windows for the desktop client).

---

<div class="post-metadata">

### Author: ![numaelis](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/n/9de053/32.png) [@numaelis](https://discuss.tryton.org/u/numaelis)
#### Post date: [September 11, 2021, 12:46pm UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/5 "2021-09-11T12:46:06Z")

</div>

also as a small statistical message and that supports html tag.

```auto
<strong><font color='blue'>Invoices: \n\t authorized : 20\n\t not authorized : 2</font></strong>

```

---

<div class="post-metadata">

### Author: ![numaelis](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/n/9de053/32.png) [@numaelis](https://discuss.tryton.org/u/numaelis)
#### Post date: [September 12, 2021, 12:14am UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/6 "2021-09-12T00:14:19Z")

</div>

as an informative warning

example :

```auto
def add_invoice_lines(self, purchase):
    products_sold_warning, lines = self.find_lines(purchase)
    self.lines = lines
    if products_sold_warning:
        self._message = "the products %s were already sold in the previous invoice "%(str(products_sold_warning))

```

---

<div class="post-metadata">

### Author: ![2cadz](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/2cadz/32/130_2.png) [@2cadz](https://discuss.tryton.org/u/2cadz)
#### Post date: [October 25, 2021, 5:02pm UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/7 "2021-10-25T17:02:54Z")

</div>

> [@ced](#):
>
> Instead we could use the message notification that client already has (like when record is saved) and have a dedicated method (decorated by `fields.depends`) that the client will call each time one of the dependencies are modified. It returns a text that is display like a message notification until the user does an action that remove it.

👍 I like this idea

---

<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: [December 16, 2021, 9:42am UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/8 "2021-12-16T09:42:54Z")

</div>

I started an implementation on [Notification message (#11065) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue11065)

---

<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: [February 1, 2022, 5:08pm UTC](https://discuss.tryton.org/t/allow-the-form-view-to-emit-informative-popup-messages/4611/9 "2022-02-01T17:08:32Z")

</div>

The implementation is ready for testing.
