[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:
parent
5f79cbd029
commit
9671ae2a2d
|
@ -5782,16 +5782,17 @@ 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'):
|
||||||
# Concatenate multiple warnings
|
if method_res['warning']:
|
||||||
warning = result['warning']
|
# Concatenate multiple warnings
|
||||||
warning['message'] = '\n\n'.join(filter(None, [
|
warning = result['warning']
|
||||||
warning.get('title'),
|
warning['message'] = '\n\n'.join(filter(None, [
|
||||||
warning.get('message'),
|
warning.get('title'),
|
||||||
method_res['warning'].get('title'),
|
warning.get('message'),
|
||||||
method_res['warning'].get('message')
|
method_res['warning'].get('title'),
|
||||||
]))
|
method_res['warning'].get('message')
|
||||||
warning['title'] = _('Warnings')
|
]))
|
||||||
|
warning['title'] = _('Warnings')
|
||||||
else:
|
else:
|
||||||
result['warning'] = method_res['warning']
|
result['warning'] = method_res['warning']
|
||||||
return
|
return
|
||||||
|
@ -5834,16 +5835,17 @@ 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'):
|
||||||
# Concatenate multiple warnings
|
if method_res['warning']:
|
||||||
warning = result['warning']
|
# Concatenate multiple warnings
|
||||||
warning['message'] = '\n\n'.join(filter(None, [
|
warning = result['warning']
|
||||||
warning.get('title'),
|
warning['message'] = '\n\n'.join(filter(None, [
|
||||||
warning.get('message'),
|
warning.get('title'),
|
||||||
method_res['warning'].get('title'),
|
warning.get('message'),
|
||||||
method_res['warning'].get('message')
|
method_res['warning'].get('title'),
|
||||||
]))
|
method_res['warning'].get('message')
|
||||||
warning['title'] = _('Warnings')
|
]))
|
||||||
|
warning['title'] = _('Warnings')
|
||||||
else:
|
else:
|
||||||
result['warning'] = method_res['warning']
|
result['warning'] = method_res['warning']
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|
Loading…
Reference in New Issue