[FIX] web: statusbar field on mobile doesn't show current value
closes odoo/odoo#103715 X-original-commit: a045d4555f3546bf9b0327b24f5c6f3fecf247f1 Signed-off-by: Luca Vitali <luvi@odoo.com>
This commit is contained in:
@@ -45,8 +45,8 @@ export class StatusBarField extends Component {
|
||||
get currentName() {
|
||||
switch (this.props.record.fields[this.props.name].type) {
|
||||
case "many2one": {
|
||||
const item = this.options.find((item) => item.isSelected);
|
||||
return item ? item.name : "";
|
||||
const item = this.options.find((item) => this.props.value && item.id === this.props.value[0]);
|
||||
return item ? item.display_name : "";
|
||||
}
|
||||
case "selection": {
|
||||
const item = this.options.find((item) => item[0] === this.props.value);
|
||||
|
||||
@@ -60,6 +60,11 @@ QUnit.module("Mobile Fields", ({ beforeEach }) => {
|
||||
".o_statusbar_status .dropdown-menu",
|
||||
"dropdown should be hidden"
|
||||
);
|
||||
assert.strictEqual(
|
||||
fixture.querySelector(".o_statusbar_status button.dropdown-toggle").textContent.trim(),
|
||||
"aaa",
|
||||
"statusbar button should display current field value"
|
||||
);
|
||||
|
||||
// open the dropdown
|
||||
await click(fixture, ".o_statusbar_status > button");
|
||||
@@ -115,8 +120,8 @@ QUnit.module("Mobile Fields", ({ beforeEach }) => {
|
||||
assert.strictEqual(
|
||||
fixture.querySelector(".o_statusbar_status button.dropdown-toggle").textContent.trim(),
|
||||
"",
|
||||
"statusbar button has no text"
|
||||
); // Behavior as of saas-15, might be improved
|
||||
"statusbar button shouldn't have text for null field value"
|
||||
);
|
||||
|
||||
await click(fixture, ".o_statusbar_status button.dropdown-toggle");
|
||||
assert.containsOnce(
|
||||
|
||||
Reference in New Issue
Block a user