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