From 57ffbe89ef62760c9a2a4224d4389b320fb7dfab Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Thu, 30 Aug 2018 16:41:05 +0200 Subject: [PATCH] [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. --- odoo/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/odoo/models.py b/odoo/models.py index 2dc663e1cc1..1cf1c391e1e 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -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 [