Form view destroyed when closing user error message box
In order to reproduce this behavior:
create à new record from a Many2One field (using the manifying glass and hitting the "new" button in the search window).
Then the form appears in a new window.
In my case, all required fields are filled, but one (or many) other fields are invalid according to the validate() method checks on the model.
Clicking on the "validate" button of the form send datas to the server and a user error is raised (because of the validate method)
Closing the "Error message box" just destroyed the filled form.
We've fixed it by checking the return values of the callback passed to the WinForm() (from WinSearch).
Doing something like that:
(win_form.py)
@@ -430,8 +430,8 @@ class WinForm(NoModal, InfoBar):
+ if self.callback(result) or not result:
+ self.destroy()
So each callback must return True/False depending on what happends in it.
Then the view is destroyed if not result or result and the callback returns True because form is saved into a new model.