From 39e5d93c97e96514a3b48ab8c35f24b4400a200e Mon Sep 17 00:00:00 2001 From: RomainLibert Date: Mon, 9 Sep 2019 12:45:16 +0000 Subject: [PATCH] [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) --- addons/web/static/src/js/views/basic/basic_model.js | 9 +++++---- 1 file 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