[FIX] models: onchange warnings concatenation

This revision is related 420e198aa5.

onchanges can return "False" as warning value.
In such a case, prevent the concatenation with previous results.
This commit is contained in:
Denis Ledoux 2015-09-28 14:45:29 +02:00
parent 5f79cbd029
commit 9671ae2a2d
1 changed files with 22 additions and 20 deletions

View File

@ -5782,7 +5782,8 @@ class BaseModel(object):
if 'domain' in method_res: if 'domain' in method_res:
result.setdefault('domain', {}).update(method_res['domain']) result.setdefault('domain', {}).update(method_res['domain'])
if 'warning' in method_res: if 'warning' in method_res:
if 'warning' in result: if result.get('warning'):
if method_res['warning']:
# Concatenate multiple warnings # Concatenate multiple warnings
warning = result['warning'] warning = result['warning']
warning['message'] = '\n\n'.join(filter(None, [ warning['message'] = '\n\n'.join(filter(None, [
@ -5834,7 +5835,8 @@ class BaseModel(object):
if 'domain' in method_res: if 'domain' in method_res:
result.setdefault('domain', {}).update(method_res['domain']) result.setdefault('domain', {}).update(method_res['domain'])
if 'warning' in method_res: if 'warning' in method_res:
if 'warning' in result: if result.get('warning'):
if method_res['warning']:
# Concatenate multiple warnings # Concatenate multiple warnings
warning = result['warning'] warning = result['warning']
warning['message'] = '\n\n'.join(filter(None, [ warning['message'] = '\n\n'.join(filter(None, [