From 9bce0ea081e93e5f96a48a2019ba73f39e94affc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 13 Sep 2015 00:22:17 +0200 Subject: [PATCH] Popup invalid message for button pre-validation issue4930 review24341002 --- tryton/gui/window/view_form/screen/screen.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index a5478dfd19..7b1146b1c8 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -25,7 +25,7 @@ from tryton.exceptions import TrytonServerError, TrytonServerUnavailable from tryton.jsonrpc import JSONEncoder from tryton.common.domain_parser import DomainParser from tryton.common import RPCExecute, RPCException, MODELACCESS, \ - node_attributes, sur, RPCContextReload + node_attributes, sur, RPCContextReload, warning from tryton.action import Action import tryton.rpc as rpc @@ -886,7 +886,7 @@ class Screen(SignalEvent): fields = [] for field, invalid in sorted(record.invalid_fields.items()): string = record.group.fields[field].attrs['string'] - if invalid == 'required': + if invalid == 'required' or invalid == [[field, '!=', None]]: fields.append(_('"%s" is required') % string) elif invalid == 'domain': fields.append(domain_string % string) @@ -950,6 +950,7 @@ class Screen(SignalEvent): domain = record.expr_eval( button.get('states', {})).get('pre_validate', []) if not record.validate(fields, pre_validate=domain): + warning(self.invalid_message(record), _('Pre-validation')) self.display(set_cursor=True) if domain: # Reset valid state with normal domain