[IMP] models.py: Concatenate warning messages if they are different

Purpose
=======

When several warnings are raised, in an onchange for example, the warning
messages and titles are concatenated on the dialog, even if they are
exactly the same.

Specification
=============

Don't concatenate warning messages if they are exactly the same.
This commit is contained in:
Yannick Tivisse
2018-09-25 18:39:32 +02:00
committed by Aurélien Warnon
parent 856c2e9008
commit 57ffbe89ef
+3 -1
View File
@@ -5251,7 +5251,9 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
if res.get('domain'):
result.setdefault('domain', {}).update(res['domain'])
if res.get('warning'):
if result.get('warning'):
if result.get('warning') and \
(result['warning'].get('title') != res['warning'].get('title') or \
result['warning'].get('message') != res['warning'].get('message')):
# Concatenate multiple warnings
warning = result['warning']
warning['message'] = '\n\n'.join(s for s in [