diff options
| author | RomainLibert <rli@odoo.com> | 2019-09-09 12:45:16 +0000 |
|---|---|---|
| committer | RomainLibert <rli@odoo.com> | 2019-09-09 12:53:52 +0000 |
| commit | 39e5d93c97e96514a3b48ab8c35f24b4400a200e (patch) | |
| tree | fa9c1b7d33ff754fb2bf554c637d17b7960b59fe /addons/web/static/src/js/views | |
| parent | 68c753af5564b8cc6cf3fcd51933e5e56d85de97 (diff) | |
[FIX] web: use New as default value for breadcrumb
Before this commit if `display_name` was in the view, the breadcrumb when
creating a new record, the breadcrumb would display either `Unnamed`,
either the last value of `_title` in `action_mixin`.
The default value when creating a record should be `New`, but the return
was ignored because `display_name` was found in the view
closes odoo/odoo#36565
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index f7005a11b9a..614602a5791 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -678,13 +678,14 @@ var BasicModel = AbstractModel.extend({ */ getName: function (id) { var record = this.localData[id]; + var returnValue = ''; if (record._changes && 'display_name' in record._changes) { - return record._changes.display_name; + returnValue = record._changes.display_name; } - if ('display_name' in record.data) { - return record.data.display_name; + else if ('display_name' in record.data) { + returnValue = record.data.display_name; } - return _t("New"); + return returnValue || _t("New"); }, /** * Returns true if a record is dirty. A record is considered dirty if it has |
