[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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user