Allow the form view to emit informative popup messages

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)}

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 :smirk:

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.

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.

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).

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

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

as an informative warning

example :

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