[IMP] web, *: replace search more with view all
This commit changes the behavior of the "Search More..." option in Many2XAutocomplete and analytic distribution by making it available as long as there's at least one record in the search results and by renaming it to "View all". task-3258625 closes odoo/odoo#126041 Related: odoo/enterprise#43660 Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
This commit is contained in:
+7
-7
@@ -77,7 +77,7 @@ export class AnalyticDistribution extends Component {
|
||||
|
||||
this.selectCreateIsOpen = false;
|
||||
this.addDialog = useOwnedDialogs();
|
||||
this.onSearchMore = this._onSearchMore.bind(this);
|
||||
this.onViewAll = this._onViewAll.bind(this);
|
||||
}
|
||||
|
||||
// Lifecycle
|
||||
@@ -245,15 +245,15 @@ export class AnalyticDistribution extends Component {
|
||||
color: result.color,
|
||||
}));
|
||||
|
||||
if (searchLimit < records.length) {
|
||||
if (records.length) {
|
||||
options.push({
|
||||
label: this.env._t("Search More..."),
|
||||
action: (editedTag) => this.onSearchMore(searchTerm, editedTag),
|
||||
classList: "o_m2o_dropdown_option o_m2o_dropdown_option_search_more",
|
||||
label: this.env._t("View all"),
|
||||
action: (editedTag) => this.onViewAll(searchTerm, editedTag),
|
||||
classList: "o_m2o_dropdown_option o_m2o_dropdown_option_view_all",
|
||||
});
|
||||
}
|
||||
|
||||
if (!options.length) {
|
||||
else {
|
||||
options.push({
|
||||
label: this.env._t("No Analytic Accounts for this plan"),
|
||||
classList: "o_m2o_no_result",
|
||||
@@ -264,7 +264,7 @@ export class AnalyticDistribution extends Component {
|
||||
return options;
|
||||
}
|
||||
|
||||
async _onSearchMore(searchTerm, editedTag) {
|
||||
async _onViewAll(searchTerm, editedTag) {
|
||||
let dynamicFilters = [];
|
||||
if (searchTerm.length) {
|
||||
dynamicFilters = [
|
||||
|
||||
@@ -249,7 +249,7 @@ QUnit.module("Analytic", (hooks) => {
|
||||
|
||||
let incompleteCountryTag = popup.querySelector("table#plan_5 .incomplete .o_analytic_account_name input");
|
||||
await click(incompleteCountryTag);
|
||||
await click(target.querySelector(".o_m2o_dropdown_option_search_more"));
|
||||
await click(target.querySelector(".o_m2o_dropdown_option_view_all"));
|
||||
|
||||
assert.containsN(target, ".modal-dialog .o_list_renderer", 1, "select create list dialog is visible");
|
||||
|
||||
@@ -281,7 +281,7 @@ QUnit.module("Analytic", (hooks) => {
|
||||
// replace the first analytic account with 4 accounts
|
||||
triggerHotkey("shift+Tab");
|
||||
await click(document.activeElement);
|
||||
await click(target.querySelector(".o_m2o_dropdown_option_search_more"));
|
||||
await click(target.querySelector(".o_m2o_dropdown_option_view_all"));
|
||||
accountRows = [...target.querySelectorAll(".modal-dialog .o_data_row")];
|
||||
for (const row of accountRows.slice(0,4)) {
|
||||
await click(row.querySelector(".o_list_record_selector input"));
|
||||
|
||||
@@ -235,7 +235,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
||||
},
|
||||
});
|
||||
|
||||
await selectDropdownItem(target, "m2o", "Search More...");
|
||||
await selectDropdownItem(target, "m2o", "View all");
|
||||
const dialog = target.querySelector(".modal");
|
||||
assert.containsNone(dialog, ".o_cp_action_menus");
|
||||
assert.containsNone(dialog, ".o_import_menu");
|
||||
|
||||
@@ -203,7 +203,7 @@ QUnit.module('LunchKanban', (hooks) => {
|
||||
await nextTick();
|
||||
assert.containsOnce(target, '.lunch_location .dropdown-item:contains(New Office)');
|
||||
|
||||
click(target, '.lunch_location .dropdown-item:not(.ui-state-active)');
|
||||
click(target, '.lunch_location .ui-menu-item:nth-child(2) .dropdown-item');
|
||||
|
||||
await nextTick();
|
||||
assert.containsN(target, 'div[role=article].o_kanban_record', 2);
|
||||
@@ -245,7 +245,7 @@ QUnit.module('LunchKanban', (hooks) => {
|
||||
assert.containsOnce(target, '.lunch_user .dropdown-item:contains(David Elora)');
|
||||
|
||||
expectedUserId = 2;
|
||||
click(target, '.lunch_user .dropdown-item:not(.ui-state-active)');
|
||||
click(target, '.lunch_user .ui-menu-item:nth-child(2) .dropdown-item');
|
||||
|
||||
await nextTick();
|
||||
const wallet = target.querySelector('.o_lunch_banner .col-9 > .d-flex > span:nth-child(2)');
|
||||
@@ -253,7 +253,7 @@ QUnit.module('LunchKanban', (hooks) => {
|
||||
|
||||
click(target, '.lunch_location input');
|
||||
await nextTick();
|
||||
click(target, '.lunch_location .dropdown-item:not(.ui-state-active)');
|
||||
click(target, '.lunch_location .ui-menu-item:nth-child(2) .dropdown-item');
|
||||
|
||||
await nextTick();
|
||||
const user = target.querySelector('.lunch_user input');
|
||||
|
||||
@@ -145,8 +145,9 @@ QUnit.module('favorite filter widget', (hooks) => {
|
||||
assert.isVisible(fixture.querySelector('.o_mass_mailing_save_filter_container'),
|
||||
"should have option to save filter if no filter is set");
|
||||
await testUtils.click(fixture.querySelector('.o_field_mailing_filter input'));
|
||||
assert.containsOnce($dropdown, 'li.ui-menu-item',
|
||||
"there should be only one existing filter");
|
||||
assert.containsN($dropdown, 'li.ui-menu-item',
|
||||
2,
|
||||
"there should be only one existing filter as well as the View all option");
|
||||
// create a new filter
|
||||
await testUtils.click(fixture, '.o_mass_mailing_add_filter');
|
||||
fixture.querySelector('.o_mass_mailing_filter_name').value = 'event promo - new users';
|
||||
@@ -166,8 +167,8 @@ QUnit.module('favorite filter widget', (hooks) => {
|
||||
// Ensures input is not focussed otherwise clicking on it will just close the dropdown instead of opening it
|
||||
fixture.querySelector('.o_field_mailing_filter .o_input_dropdown input').blur();
|
||||
await testUtils.click(fixture.querySelector('.o_field_mailing_filter input'));
|
||||
assert.containsN($dropdown, 'li.ui-menu-item', 2,
|
||||
"there should be two existing filters");
|
||||
assert.containsN($dropdown, 'li.ui-menu-item', 3,
|
||||
"there should be two existing filters (and the View all option)");
|
||||
await testUtils.clickSave(fixture);
|
||||
});
|
||||
|
||||
@@ -289,7 +290,7 @@ QUnit.module('favorite filter widget', (hooks) => {
|
||||
await testUtils.click(fixture.querySelector('.o_field_mailing_filter input'));
|
||||
fixture.querySelector('.o_field_mailing_filter input').autocomplete = 'widget';
|
||||
const $dropdown = fixture.querySelector('.o_field_mailing_filter .dropdown');
|
||||
await testUtils.click($dropdown.lastElementChild, 'li');
|
||||
await testUtils.click($dropdown.lastElementChild.firstElementChild);
|
||||
assert.equal(fixture.querySelector('.o_domain_show_selection_button').textContent.trim(), '1 record(s)',
|
||||
"applied filter should only display single record (only Azure)");
|
||||
await testUtils.clickSave(fixture);
|
||||
|
||||
@@ -16,7 +16,7 @@ export class OrderField extends Many2OneField {
|
||||
// hide the search more option from the dropdown menu
|
||||
return {
|
||||
...super.Many2XAutocompleteProps,
|
||||
noSearchMore: true,
|
||||
noViewAll: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,6 @@ QUnit.module('sale_expense', {
|
||||
await clickDropdown(this.target, "sale_order_id");
|
||||
|
||||
assert.containsN(this.target, 'li.o-autocomplete--dropdown-item', 9);
|
||||
assert.containsNone(this.target, '.o_m2o_dropdown_option_search_more', "Should not display the 'Search More... option'");
|
||||
assert.containsNone(this.target, '.o_m2o_dropdown_option_view_all', "Should not display the 'View all option'");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -67,8 +67,8 @@ export class CalendarFilterPanel extends Component {
|
||||
|
||||
if (records.length > 7) {
|
||||
options.push({
|
||||
label: _t("Search More..."),
|
||||
action: () => this.onSearchMore(section, resModel, domain, request),
|
||||
label: _t("View all"),
|
||||
action: () => this.onViewAll(section, resModel, domain, request),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ export class CalendarFilterPanel extends Component {
|
||||
return options;
|
||||
}
|
||||
|
||||
async onSearchMore(section, resModel, domain, request) {
|
||||
async onViewAll(section, resModel, domain, request) {
|
||||
const dynamicFilters = [];
|
||||
if (request.length) {
|
||||
const nameGets = await this.orm.call(resModel, "name_search", [], {
|
||||
|
||||
@@ -227,7 +227,7 @@ export class PropertyValue extends Component {
|
||||
: false;
|
||||
|
||||
if (newValue && newValue[0] && newValue[1] === undefined) {
|
||||
// The "Search More" option in the Many2XAutocomplete component
|
||||
// The "View all" option in the Many2XAutocomplete component
|
||||
// only return the record ID, and not the name. But we need to name
|
||||
// in the component props to be able to display it.
|
||||
// Make a RPC call to resolve the display name of the record.
|
||||
|
||||
@@ -284,11 +284,11 @@ export class Many2XAutocomplete extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.props.noSearchMore && this.props.searchLimit < records.length) {
|
||||
if (!this.props.noViewAll && records.length > 0) {
|
||||
options.push({
|
||||
label: this.env._t("Search More..."),
|
||||
action: this.onSearchMore.bind(this, request),
|
||||
classList: "o_m2o_dropdown_option o_m2o_dropdown_option_search_more",
|
||||
label: this.env._t("View all"),
|
||||
action: this.onViewAll.bind(this, request),
|
||||
classList: "o_m2o_dropdown_option o_m2o_dropdown_option_view_all",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -326,10 +326,10 @@ export class Many2XAutocomplete extends Component {
|
||||
|
||||
async onBarcodeSearch() {
|
||||
const autoCompleteInput = this.autoCompleteContainer.el.querySelector("input");
|
||||
return this.onSearchMore(autoCompleteInput.value);
|
||||
return this.onViewAll(autoCompleteInput.value);
|
||||
}
|
||||
|
||||
async onSearchMore(request) {
|
||||
async onViewAll(request) {
|
||||
const { resModel, getDomain, context, fieldString } = this.props;
|
||||
|
||||
const domain = getDomain();
|
||||
@@ -339,7 +339,7 @@ export class Many2XAutocomplete extends Component {
|
||||
name: request,
|
||||
args: domain,
|
||||
operator: "ilike",
|
||||
limit: this.props.searchMoreLimit,
|
||||
limit: this.props.viewAllLimit,
|
||||
context,
|
||||
});
|
||||
|
||||
@@ -379,8 +379,8 @@ Many2XAutocomplete.props = {
|
||||
getDomain: Function,
|
||||
searchLimit: { type: Number, optional: true },
|
||||
quickCreate: { type: [Function, { value: null }], optional: true },
|
||||
noSearchMore: { type: Boolean, optional: true },
|
||||
searchMoreLimit: { type: Number, optional: true },
|
||||
noViewAll: { type: Boolean, optional: true },
|
||||
viewAllLimit: { type: Number, optional: true },
|
||||
fieldString: String,
|
||||
id: { type: String, optional: true },
|
||||
placeholder: { type: String, optional: true },
|
||||
@@ -392,7 +392,7 @@ Many2XAutocomplete.props = {
|
||||
};
|
||||
Many2XAutocomplete.defaultProps = {
|
||||
searchLimit: 7,
|
||||
searchMoreLimit: 320,
|
||||
viewAllLimit: 320,
|
||||
nameCreateField: "name",
|
||||
value: "",
|
||||
setInputFloats: () => {},
|
||||
@@ -609,7 +609,7 @@ X2ManyFieldDialog.props = {
|
||||
save: Function,
|
||||
title: String,
|
||||
delete: { optional: true },
|
||||
deleteButtonLabel: {optional: true},
|
||||
deleteButtonLabel: { optional: true },
|
||||
config: Object,
|
||||
};
|
||||
X2ManyFieldDialog.template = "web.X2ManyFieldDialog";
|
||||
@@ -697,8 +697,9 @@ export function useOpenX2ManyRecord({
|
||||
views: { form },
|
||||
});
|
||||
const { delete: canDelete, onDelete } = activeActions;
|
||||
deleteRecord = viewMode === "kanban" && canDelete ? () => onDelete(_record) : null;
|
||||
deleteButtonLabel = activeActions.type === 'one2many' ? env._t('Delete') : env._t('Remove');
|
||||
deleteRecord = viewMode === "kanban" && canDelete ? () => onDelete(_record) : null;
|
||||
deleteButtonLabel =
|
||||
activeActions.type === "one2many" ? env._t("Delete") : env._t("Remove");
|
||||
} else {
|
||||
const recordParams = {
|
||||
context: makeContext([list.context, context]),
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
readonly=""
|
||||
t-att-placeholder="props.placeholder"
|
||||
t-att-value="props.value"
|
||||
t-on-click="onSearchMore"
|
||||
t-on-click="onViewAll"
|
||||
t-on-barcode-search="onBarcodeSearch"
|
||||
/>
|
||||
<AutoComplete t-else=""
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
toggleSearchBarMenu,
|
||||
toggleMenuItem,
|
||||
} from "@web/../tests/search/helpers";
|
||||
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
|
||||
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { SearchBarMenu } from "@web/search/search_bar_menu/search_bar_menu";
|
||||
import { SearchPanel } from "@web/search/search_panel/search_panel";
|
||||
@@ -2321,7 +2321,7 @@ QUnit.module("Search", (hooks) => {
|
||||
|
||||
await doAction(webclient, 1, { viewType: "form" });
|
||||
|
||||
await selectDropdownItem(target, "company_id", "Search More...");
|
||||
await selectDropdownItem(target, "company_id", "View all");
|
||||
|
||||
assert.containsOnce(document.body, ".modal .o_list_view");
|
||||
assert.containsNone(document.body, ".modal .o_search_panel");
|
||||
@@ -3459,19 +3459,22 @@ QUnit.module("Search", (hooks) => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Don't display empty state message when some filters are availible", async (assert) => {
|
||||
const { TestComponent } = makeTestComponent();
|
||||
await makeWithSearch({
|
||||
serverData,
|
||||
Component: TestComponent,
|
||||
resModel: "partner",
|
||||
searchViewId: false,
|
||||
});
|
||||
QUnit.test(
|
||||
"Don't display empty state message when some filters are available",
|
||||
async (assert) => {
|
||||
const { TestComponent } = makeTestComponent();
|
||||
await makeWithSearch({
|
||||
serverData,
|
||||
Component: TestComponent,
|
||||
resModel: "partner",
|
||||
searchViewId: false,
|
||||
});
|
||||
|
||||
assert.containsNone(
|
||||
target,
|
||||
".o_search_panel_empty_state",
|
||||
"Search panel does not have the empty state container"
|
||||
);
|
||||
});
|
||||
assert.containsNone(
|
||||
target,
|
||||
".o_search_panel_empty_state",
|
||||
"Search panel does not have the empty state container"
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -607,7 +607,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
"foo partner 8",
|
||||
"foo partner 9",
|
||||
"foo partner 10",
|
||||
"Search More...",
|
||||
"View all",
|
||||
]
|
||||
);
|
||||
|
||||
@@ -630,7 +630,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
"foo partner 10",
|
||||
"foo partner 11",
|
||||
"foo partner 12",
|
||||
"Search More...",
|
||||
"View all",
|
||||
]
|
||||
);
|
||||
|
||||
@@ -690,7 +690,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
"foo partner 9",
|
||||
"foo partner 10",
|
||||
"foo partner 11",
|
||||
"Search More...",
|
||||
"View all",
|
||||
]
|
||||
);
|
||||
|
||||
@@ -712,7 +712,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
"foo partner 11",
|
||||
"foo partner 12",
|
||||
"foo partner 13",
|
||||
"Search More...",
|
||||
"View all",
|
||||
]
|
||||
);
|
||||
|
||||
@@ -957,12 +957,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
assert.containsN(target, ".fc-event-container .fc-event", 10, "should display 10 events");
|
||||
// move to next month
|
||||
await navigate(target, "next");
|
||||
assert.containsN(
|
||||
target,
|
||||
".fc-event-container .fc-event",
|
||||
0,
|
||||
"should display 0 events"
|
||||
);
|
||||
assert.containsN(target, ".fc-event-container .fc-event", 0, "should display 0 events");
|
||||
await pickDate(target, "2017-01-01");
|
||||
assert.containsN(
|
||||
target,
|
||||
|
||||
@@ -1921,7 +1921,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
});
|
||||
await click(target, ".o_field_many2many_selection input");
|
||||
checkGetViews = true;
|
||||
await clickOpenedDropdownItem(target, "timmy", "Search More...");
|
||||
await clickOpenedDropdownItem(target, "timmy", "View all");
|
||||
assert.verifySteps([`get_views`]);
|
||||
|
||||
assert.containsOnce(target, ".modal");
|
||||
|
||||
@@ -424,7 +424,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
"Should have 2 tags"
|
||||
);
|
||||
// load more
|
||||
await click(popover.querySelector(".o_m2o_dropdown_option_search_more"));
|
||||
await click(popover.querySelector(".o_m2o_dropdown_option_view_all"));
|
||||
// first item
|
||||
await click(document.querySelector(".o_dialog .o_list_table .o_data_row .o_data_cell"));
|
||||
assert.strictEqual(popover.querySelectorAll(".o_tag").length, 4, "Should have 4 tags");
|
||||
|
||||
@@ -163,8 +163,8 @@ QUnit.module("Fields", (hooks) => {
|
||||
const autocomplete = target.querySelector("[name='timmy'] .o-autocomplete.dropdown");
|
||||
assert.strictEqual(
|
||||
autocomplete.querySelectorAll("li").length,
|
||||
3,
|
||||
"autocomplete dropdown should have 3 entries (2 values + 'Search and Edit...')"
|
||||
4,
|
||||
"autocomplete dropdown should have 4 entries (2 values + 'View all' + 'Start typing...')"
|
||||
);
|
||||
await clickOpenedDropdownItem(target, "timmy", "gold");
|
||||
assert.containsOnce(target, "[name=timmy] .o_tag");
|
||||
@@ -245,8 +245,8 @@ QUnit.module("Fields", (hooks) => {
|
||||
|
||||
assert.strictEqual(
|
||||
autocompleteDropdown.querySelectorAll("li").length,
|
||||
2,
|
||||
"autocomplete dropdown should have 2 entry"
|
||||
3,
|
||||
"autocomplete dropdown should have 3 entries"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
@@ -439,8 +439,8 @@ QUnit.module("Fields", (hooks) => {
|
||||
|
||||
assert.strictEqual(
|
||||
autocompleteDropdown.querySelectorAll("li").length,
|
||||
2,
|
||||
"autocomplete dropdown should have 2 entry"
|
||||
3,
|
||||
"autocomplete dropdown should have 3 entries"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
@@ -495,12 +495,12 @@ QUnit.module("Fields", (hooks) => {
|
||||
|
||||
assert.strictEqual(
|
||||
autocompleteDropdown.querySelectorAll("li").length,
|
||||
2,
|
||||
"autocomplete dropdown should have 2 entry"
|
||||
3,
|
||||
"autocomplete dropdown should have 3 entries"
|
||||
);
|
||||
assert.deepEqual(
|
||||
getNodesTextContent(autocompleteDropdown.querySelectorAll("li")),
|
||||
["silver", "Start typing..."],
|
||||
["silver", "View all", "Start typing..."],
|
||||
"should contain newly added tag 'silver'"
|
||||
);
|
||||
assert.strictEqual(
|
||||
@@ -545,8 +545,8 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.containsN(
|
||||
autocompleteDropdown,
|
||||
"li",
|
||||
2,
|
||||
"autocomplete should contain 'silver' and 'Start typing...' options"
|
||||
3,
|
||||
"autocomplete should contain 'silver', 'View all' and 'Start typing...' options"
|
||||
);
|
||||
assert.strictEqual(
|
||||
autocompleteDropdown.querySelector("li a").textContent,
|
||||
@@ -564,8 +564,8 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.containsN(
|
||||
autocompleteDropdown,
|
||||
"li",
|
||||
2,
|
||||
"autocomplete should contain 'gold' and 'Start typing...' options"
|
||||
3,
|
||||
"autocomplete should contain 'gold', 'View all' and 'Start typing...' options"
|
||||
);
|
||||
assert.strictEqual(
|
||||
autocompleteDropdown.querySelector("li a").textContent,
|
||||
@@ -608,8 +608,8 @@ QUnit.module("Fields", (hooks) => {
|
||||
const autocomplete = target.querySelector("[name='timmy'] .o-autocomplete.dropdown");
|
||||
assert.strictEqual(
|
||||
autocomplete.querySelectorAll("li").length,
|
||||
3,
|
||||
"autocomplete dropdown should have 3 entries (2 values + 'Search and Edit...')"
|
||||
4,
|
||||
"autocomplete dropdown should have 4 entries (2 values + 'View all' + 'Start typing...')"
|
||||
);
|
||||
await clickOpenedDropdownItem(target, "timmy", "gold");
|
||||
|
||||
@@ -1215,7 +1215,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
</form>`,
|
||||
});
|
||||
|
||||
await selectDropdownItem(target, "timmy", "Search More...");
|
||||
await selectDropdownItem(target, "timmy", "View all");
|
||||
|
||||
assert.ok(target.querySelector(".o_dialog"), "should have open the modal");
|
||||
// + 1 for the select all
|
||||
@@ -1271,7 +1271,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
</form>`,
|
||||
});
|
||||
|
||||
await selectDropdownItem(target, "timmy", "Search More...");
|
||||
await selectDropdownItem(target, "timmy", "View all");
|
||||
|
||||
// -1 for the one that is already on the form & +1 for the select all,
|
||||
assert.containsN(
|
||||
@@ -1473,7 +1473,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
"autocomplete should contain Start typing..."
|
||||
);
|
||||
|
||||
await clickOpenedDropdownItem(target, "partner_ids", "Search More...");
|
||||
await clickOpenedDropdownItem(target, "partner_ids", "View all");
|
||||
|
||||
assert.containsN(
|
||||
target,
|
||||
@@ -1523,7 +1523,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await nameSearchProm;
|
||||
await nextTick();
|
||||
|
||||
// only Search More option should be available
|
||||
// only View all option should be available
|
||||
assert.containsOnce(
|
||||
$(target.querySelector(".o-autocomplete.dropdown")),
|
||||
"li.o_m2o_dropdown_option",
|
||||
@@ -1531,11 +1531,11 @@ QUnit.module("Fields", (hooks) => {
|
||||
);
|
||||
assert.containsOnce(
|
||||
$(target.querySelector(".o-autocomplete.dropdown")),
|
||||
"li.o_m2o_dropdown_option a:contains(Search More...)",
|
||||
"autocomplete option should be Search More"
|
||||
"li.o_m2o_dropdown_option a:contains(View all)",
|
||||
"autocomplete option should be View all"
|
||||
);
|
||||
|
||||
await clickOpenedDropdownItem(target, "partner_ids", "Search More...");
|
||||
await clickOpenedDropdownItem(target, "partner_ids", "View all");
|
||||
|
||||
assert.containsN(
|
||||
document.body,
|
||||
@@ -1563,7 +1563,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await nameSearchProm;
|
||||
await nextTick();
|
||||
|
||||
// only Search More option should be available
|
||||
// only View all option should be available
|
||||
assert.containsOnce(
|
||||
$(target.querySelector(".o-autocomplete.dropdown")),
|
||||
"li.o_m2o_dropdown_option",
|
||||
@@ -1571,8 +1571,8 @@ QUnit.module("Fields", (hooks) => {
|
||||
);
|
||||
assert.containsOnce(
|
||||
$(target.querySelector(".o-autocomplete.dropdown")),
|
||||
"li.o_m2o_dropdown_option a:contains(Search More)",
|
||||
"autocomplete option should be Search More"
|
||||
"li.o_m2o_dropdown_option a:contains(View all)",
|
||||
"autocomplete option should be View all"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1757,7 +1757,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_field_many2many_tags .o-autocomplete--dropdown-menu")
|
||||
.textContent,
|
||||
"goldsilver"
|
||||
"goldsilverView all"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -383,9 +383,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
);
|
||||
|
||||
// load more
|
||||
await click(
|
||||
document.querySelector(".o-overlay-container .o_m2o_dropdown_option_search_more")
|
||||
);
|
||||
await click(document.querySelector(".o-overlay-container .o_m2o_dropdown_option_view_all"));
|
||||
await click(document.querySelector(".o_dialog .o_list_table .o_data_row .o_data_cell"));
|
||||
assert.strictEqual(
|
||||
target.querySelector(
|
||||
|
||||
@@ -423,8 +423,13 @@ QUnit.module("Fields", (hooks) => {
|
||||
</sheet>
|
||||
</form>`,
|
||||
mockRPC(route, { args, method, kwargs }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name" && kwargs.context.show_address) {
|
||||
return [{id: 4, display_name: "aaa\nStreet\nCity ZIP"}];
|
||||
if (
|
||||
method === "read" &&
|
||||
args[1].length === 1 &&
|
||||
args[1][0] === "display_name" &&
|
||||
kwargs.context.show_address
|
||||
) {
|
||||
return [{ id: 4, display_name: "aaa\nStreet\nCity ZIP" }];
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -462,8 +467,13 @@ QUnit.module("Fields", (hooks) => {
|
||||
</sheet>
|
||||
</form>`,
|
||||
mockRPC(route, { args, kwargs, method }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name" && kwargs.context.show_address) {
|
||||
return args.map((id) => ({id, display_name: namegets[id]}));
|
||||
if (
|
||||
method === "read" &&
|
||||
args[1].length === 1 &&
|
||||
args[1][0] === "display_name" &&
|
||||
kwargs.context.show_address
|
||||
) {
|
||||
return args.map((id) => ({ id, display_name: namegets[id] }));
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -522,8 +532,13 @@ QUnit.module("Fields", (hooks) => {
|
||||
<field name="turtles" />
|
||||
</form>`,
|
||||
mockRPC(route, { args, kwargs, method }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name" && kwargs.context.show_address) {
|
||||
return [{id: 2, display_name: "second record\nrue morgue\nparis 75013"}];
|
||||
if (
|
||||
method === "read" &&
|
||||
args[1].length === 1 &&
|
||||
args[1][0] === "display_name" &&
|
||||
kwargs.context.show_address
|
||||
) {
|
||||
return [{ id: 2, display_name: "second record\nrue morgue\nparis 75013" }];
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -566,8 +581,13 @@ QUnit.module("Fields", (hooks) => {
|
||||
<field name="turtles" />
|
||||
</form>`,
|
||||
mockRPC(route, { kwargs, method, args }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name" && kwargs.context.show_address) {
|
||||
return [{id: 2, display_name: "second record\nrue morgue\nparis 75013"}];
|
||||
if (
|
||||
method === "read" &&
|
||||
args[1].length === 1 &&
|
||||
args[1][0] === "display_name" &&
|
||||
kwargs.context.show_address
|
||||
) {
|
||||
return [{ id: 2, display_name: "second record\nrue morgue\nparis 75013" }];
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -618,7 +638,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
</form>`,
|
||||
});
|
||||
|
||||
await selectDropdownItem(target, "trululu", "Search More...");
|
||||
await selectDropdownItem(target, "trululu", "View all");
|
||||
|
||||
assert.strictEqual($("tr.o_data_row").length, 9, "should display 9 records");
|
||||
assert.equal(target.querySelector(".o_field_widget[name=trululu] input").value, "aaa");
|
||||
@@ -632,7 +652,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"many2ones: Open the selection dialog several times using the 'Search More...' button with a context containing 'search_default_...'",
|
||||
"many2ones: Open the selection dialog several times using the 'View all' button with a context containing 'search_default_...'",
|
||||
async function (assert) {
|
||||
for (let i = 5; i < 11; i++) {
|
||||
serverData.models.partner.records.push({ id: i, display_name: `Partner ${i}` });
|
||||
@@ -664,7 +684,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
</form>`,
|
||||
});
|
||||
|
||||
await selectDropdownItem(target, "trululu", "Search More...");
|
||||
await selectDropdownItem(target, "trululu", "View all");
|
||||
|
||||
let modal = target.querySelector(".modal");
|
||||
assert.containsOnce(modal, ".o_data_row", "should display 1 records");
|
||||
@@ -673,7 +693,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await click(modal, ".btn-close");
|
||||
assert.containsNone(modal, ".modal");
|
||||
|
||||
await selectDropdownItem(target, "trululu", "Search More...");
|
||||
await selectDropdownItem(target, "trululu", "View all");
|
||||
modal = target.querySelector(".modal");
|
||||
assert.containsOnce(modal, ".o_data_row", "should display 1 records");
|
||||
assert.deepEqual(getFacetTexts(modal), ["Displayed name\nPartner 10"]);
|
||||
@@ -1026,10 +1046,10 @@ QUnit.module("Fields", (hooks) => {
|
||||
});
|
||||
|
||||
await click(target, ".o_field_many2one input");
|
||||
assert.containsNone(
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".dropdown-menu li.o_m2o_dropdown_option",
|
||||
"autocomplete should not contains dropdown options"
|
||||
"autocomplete should contain the View all dropdown option"
|
||||
);
|
||||
assert.containsOnce(
|
||||
target,
|
||||
@@ -1156,7 +1176,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
QUnit.test("many2one in edit mode", async function (assert) {
|
||||
assert.expect(17);
|
||||
|
||||
// create 10 partners to have the 'Search More' option in the autocomplete dropdown
|
||||
// create 10 partners
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const id = 20 + i;
|
||||
serverData.models.partner.records.push({ id, display_name: `Partner ${id}` });
|
||||
@@ -1213,7 +1233,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.containsOnce(
|
||||
dropdown,
|
||||
"li.o_m2o_dropdown_option",
|
||||
'autocomplete should contain "Search More"'
|
||||
'autocomplete should contain "View all"'
|
||||
);
|
||||
assert.containsNone(
|
||||
dropdown,
|
||||
@@ -1238,11 +1258,11 @@ QUnit.module("Fields", (hooks) => {
|
||||
"value of the m2o should have been correctly updated"
|
||||
);
|
||||
|
||||
// change the value of the m2o with a record in the 'Search More' modal
|
||||
// change the value of the m2o with a record in the 'View allodal
|
||||
await clickDropdown(target, "trululu");
|
||||
// click on 'Search More' (mouseenter required by ui-autocomplete)
|
||||
// click on 'View all' (mouseenter required by ui-autocomplete)
|
||||
dropdown = target.querySelector(".o_field_many2one[name='trululu'] .dropdown-menu");
|
||||
await click(dropdown.querySelector(".o_m2o_dropdown_option_search_more"));
|
||||
await click(dropdown.querySelector(".o_m2o_dropdown_option_view_all"));
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".modal .o_list_view",
|
||||
@@ -1431,7 +1451,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
mockRPC(route, { args, kwargs, method }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name") {
|
||||
assert.step(method);
|
||||
return args.map((id) => ({id, display_name: namegets[id]}));
|
||||
return args.map((id) => ({ id, display_name: namegets[id] }));
|
||||
}
|
||||
if (method === "name_search") {
|
||||
assert.step(method);
|
||||
@@ -1544,7 +1564,9 @@ QUnit.module("Fields", (hooks) => {
|
||||
mockRPC(route, { method, args }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name") {
|
||||
count++;
|
||||
return Promise.resolve([{id: 1, display_name: "first record\nand some address"}]);
|
||||
return Promise.resolve([
|
||||
{ id: 1, display_name: "first record\nand some address" },
|
||||
]);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1571,7 +1593,9 @@ QUnit.module("Fields", (hooks) => {
|
||||
mockRPC(route, { method, args }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name") {
|
||||
count++;
|
||||
return Promise.resolve([{id: 1, display_name: "first record\nand some address"}]);
|
||||
return Promise.resolve([
|
||||
{ id: 1, display_name: "first record\nand some address" },
|
||||
]);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1986,7 +2010,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
</field>
|
||||
</sheet>
|
||||
</form>`,
|
||||
mockRPC(route, { method, args}) {
|
||||
mockRPC(route, { method, args }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name") {
|
||||
throw new Error("read(['display_name']) should not be called");
|
||||
}
|
||||
@@ -2026,7 +2050,11 @@ QUnit.module("Fields", (hooks) => {
|
||||
</sheet>
|
||||
</form>`,
|
||||
mockRPC(route, { method, args }) {
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name") {
|
||||
if (
|
||||
method === "read" &&
|
||||
args[1].length === 1 &&
|
||||
args[1][0] === "display_name"
|
||||
) {
|
||||
throw new Error("read(['display_name']) should not be called");
|
||||
}
|
||||
},
|
||||
@@ -2838,11 +2866,16 @@ QUnit.module("Fields", (hooks) => {
|
||||
</form>`,
|
||||
mockRPC(route, { args, method }) {
|
||||
count++;
|
||||
if (method === "read" && args[1].length === 1 && args[1][0] === "display_name" && args[0] === 2) {
|
||||
if (
|
||||
method === "read" &&
|
||||
args[1].length === 1 &&
|
||||
args[1][0] === "display_name" &&
|
||||
args[0] === 2
|
||||
) {
|
||||
// LPE: any call_kw route can take either [ids] or id as the first
|
||||
// argument as model.browse() in python supports both
|
||||
// With the basic_model, read is passed only an id, not an array
|
||||
return Promise.resolve([{id: 2, display_name: "hello world\nso much noise"}]);
|
||||
return Promise.resolve([{ id: 2, display_name: "hello world\nso much noise" }]);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -3388,7 +3421,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.containsNone(target, ".ui-autocomplete a:contains(Create and Edit)");
|
||||
|
||||
await editInput(target, ".o_field_many2one[name=product_id] input", "");
|
||||
await clickOpenedDropdownItem(target, "product_id", "Search More...");
|
||||
await clickOpenedDropdownItem(target, "product_id", "View all");
|
||||
|
||||
assert.containsOnce(target, ".modal-dialog.modal-lg");
|
||||
|
||||
@@ -3767,7 +3800,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await click(target.querySelectorAll(".o_data_cell")[0]);
|
||||
await click(target, ".o_field_many2one input");
|
||||
|
||||
assert.containsOnce(target, ".o_field_many2one .o-autocomplete--dropdown-item");
|
||||
assert.containsN(target, ".o_field_many2one .o-autocomplete--dropdown-item", 2);
|
||||
});
|
||||
|
||||
QUnit.test("many2one: domain set in view and on field", async function (assert) {
|
||||
@@ -3794,7 +3827,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await click(target.querySelectorAll(".o_data_cell")[0]);
|
||||
await click(target, ".o_field_many2one input");
|
||||
|
||||
assert.containsOnce(target, ".o_field_many2one .o-autocomplete--dropdown-item");
|
||||
assert.containsN(target, ".o_field_many2one .o-autocomplete--dropdown-item", 2);
|
||||
});
|
||||
|
||||
QUnit.test("many2one: domain updated by an onchange", async function (assert) {
|
||||
@@ -3843,7 +3876,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
});
|
||||
|
||||
QUnit.test("search more in many2one: no text in input", async function (assert) {
|
||||
// when the user clicks on 'Search More...' in a many2one dropdown, and there is no text
|
||||
// when the user clicks on 'View all' in a many2one dropdown, and there is no text
|
||||
// in the input (i.e. no value to search on), we bypass the name_search that is meant to
|
||||
// return a list of preselected ids to filter on in the list view (opened in a dialog)
|
||||
assert.expect(7);
|
||||
@@ -3881,7 +3914,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await triggerEvent(field, null, "change");
|
||||
|
||||
await click(target, `.o_field_widget[name="trululu"] input`);
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_search_more`);
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_view_all`);
|
||||
|
||||
assert.verifySteps([
|
||||
"get_views", // main form view
|
||||
@@ -3893,7 +3926,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
});
|
||||
|
||||
QUnit.test("search more in many2one: text in input", async function (assert) {
|
||||
// when the user clicks on 'Search More...' in a many2one dropdown, and there is some
|
||||
// when the user clicks on 'View all' in a many2one dropdown, and there is some
|
||||
// text in the input, we perform a name_search to get a (limited) list of preselected
|
||||
// ids and we add a dynamic filter (with those ids) to the search view in the dialog, so
|
||||
// that the user can remove this filter to bypass the limit
|
||||
@@ -3928,7 +3961,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await click(target, `.o_field_widget[name="trululu"] input`);
|
||||
|
||||
await editInput(target, ".o_field_widget[name='trululu'] input", "test");
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_search_more`);
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_view_all`);
|
||||
|
||||
assert.containsOnce(target, ".modal .o_list_view");
|
||||
assert.containsOnce(
|
||||
@@ -3975,7 +4008,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
await click(target, `.o_field_widget[name="trululu"] input`);
|
||||
|
||||
await editInput(target, ".o_field_widget[name='trululu'] input", "test");
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_search_more`);
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_view_all`);
|
||||
|
||||
// dropdown selector
|
||||
const searchDropdown = ".o_control_panel_actions .o-dropdown";
|
||||
@@ -4047,7 +4080,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
});
|
||||
|
||||
QUnit.test("search more in many2one: resequence inside dialog", async function (assert) {
|
||||
// when the user clicks on 'Search More...' in a many2one dropdown, resequencing inside
|
||||
// when the user clicks on 'View all' in a many2one dropdown, resequencing inside
|
||||
// the dialog works
|
||||
serverData.models.partner.fields.sequence = { string: "Sequence", type: "integer" };
|
||||
for (let i = 0; i < 8; i++) {
|
||||
@@ -4080,7 +4113,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
});
|
||||
|
||||
await editInput(target, ".o_field_widget[name='trululu'] input", "");
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_search_more`);
|
||||
await click(target, `.o_field_widget[name="trululu"] .o_m2o_dropdown_option_view_all`);
|
||||
|
||||
assert.containsOnce(target, ".modal");
|
||||
assert.containsN(target, ".modal .ui-sortable-handle", 11);
|
||||
@@ -4176,7 +4209,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
arch: '<form><field name="trululu" /></form>',
|
||||
});
|
||||
|
||||
await selectDropdownItem(target, "trululu", "Search More...");
|
||||
await selectDropdownItem(target, "trululu", "View all");
|
||||
const modal = target.querySelector(".modal");
|
||||
await toggleSearchBarMenu(modal);
|
||||
await toggleMenuItem(modal, "Bar");
|
||||
@@ -4276,7 +4309,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
</form>`,
|
||||
});
|
||||
|
||||
await selectDropdownItem(target, "trululu", "Search More...");
|
||||
await selectDropdownItem(target, "trululu", "View all");
|
||||
|
||||
const modal = target.querySelector(".modal");
|
||||
await click(modal, ".o_pager_next");
|
||||
|
||||
@@ -1115,7 +1115,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
|
||||
// Opening the "Search more..." modal
|
||||
await click(popover, ".o_field_property_definition_value input");
|
||||
await click(popover, ".o_m2o_dropdown_option_search_more");
|
||||
await click(popover, ".o_m2o_dropdown_option_view_all");
|
||||
|
||||
// Checking the model loaded
|
||||
assert.verifySteps(["partner"]);
|
||||
@@ -1129,7 +1129,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
|
||||
// Opening the "Search more..." modal
|
||||
await click(popover, ".o_field_property_definition_value input");
|
||||
await click(popover, ".o_m2o_dropdown_option_search_more");
|
||||
await click(popover, ".o_m2o_dropdown_option_view_all");
|
||||
|
||||
// Checking the model loaded
|
||||
assert.verifySteps(["res.users"]);
|
||||
|
||||
@@ -5476,7 +5476,6 @@ QUnit.module("Views", (hooks) => {
|
||||
});
|
||||
|
||||
QUnit.test("custom delete confirmation dialog", async (assert) => {
|
||||
|
||||
const listView = registry.category("views").get("list");
|
||||
class CautiousController extends listView.Controller {
|
||||
get deleteConfirmationDialogProps() {
|
||||
@@ -5514,7 +5513,12 @@ QUnit.module("Views", (hooks) => {
|
||||
);
|
||||
|
||||
await click(document, "body .modal footer button.btn-secondary");
|
||||
assert.containsN(target, "tbody td.o_list_record_selector", 4, "nothing deleted, 4 records remain");
|
||||
assert.containsN(
|
||||
target,
|
||||
"tbody td.o_list_record_selector",
|
||||
4,
|
||||
"nothing deleted, 4 records remain"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
@@ -8221,10 +8225,10 @@ QUnit.module("Views", (hooks) => {
|
||||
"the entire content should be selected on initial click"
|
||||
);
|
||||
|
||||
Object.assign(
|
||||
target.querySelector("[name=text] textarea"),
|
||||
{ selectionStart: 0, selectionEnd: 1 }
|
||||
);
|
||||
Object.assign(target.querySelector("[name=text] textarea"), {
|
||||
selectionStart: 0,
|
||||
selectionEnd: 1,
|
||||
});
|
||||
|
||||
await click(target, "[name=text] textarea");
|
||||
|
||||
@@ -10170,7 +10174,7 @@ QUnit.module("Views", (hooks) => {
|
||||
|
||||
await click(target.querySelector(".o_data_cell"));
|
||||
await clickOpenM2ODropdown(target, "m2o");
|
||||
await clickOpenedDropdownItem(target, "m2o", "Search More...");
|
||||
await clickOpenedDropdownItem(target, "m2o", "View all");
|
||||
assert.containsOnce(target, ".modal-content");
|
||||
assert.containsNone(
|
||||
target,
|
||||
@@ -11538,7 +11542,7 @@ QUnit.module("Views", (hooks) => {
|
||||
await click(rows[0], ".o_list_record_selector input");
|
||||
await click(rows[1], ".o_list_record_selector input");
|
||||
await click(rows[0].querySelector(".o_data_cell"));
|
||||
await selectDropdownItem(target, "m2m", "Search More...");
|
||||
await selectDropdownItem(target, "m2m", "View all");
|
||||
assert.containsOnce(document.body, ".modal", "should have open the modal");
|
||||
|
||||
await click(target.querySelector(".modal .o_data_row .o_field_cell"));
|
||||
@@ -17510,19 +17514,22 @@ QUnit.module("Views", (hooks) => {
|
||||
assert.strictEqual(td2.textContent, "61%");
|
||||
});
|
||||
|
||||
QUnit.test("Formatted group operator with digit precision on the field definition", async function (assert) {
|
||||
serverData.models.foo.fields.qux.digits = [16, 3];
|
||||
await makeView({
|
||||
type: "list",
|
||||
resModel: "foo",
|
||||
serverData,
|
||||
arch: '<tree><field name="qux"/></tree>',
|
||||
groupBy: ["bar"],
|
||||
});
|
||||
const [td1, td2] = target.querySelectorAll("td.o_list_number");
|
||||
assert.strictEqual(td1.textContent, "9.000");
|
||||
assert.strictEqual(td2.textContent, "10.400");
|
||||
});
|
||||
QUnit.test(
|
||||
"Formatted group operator with digit precision on the field definition",
|
||||
async function (assert) {
|
||||
serverData.models.foo.fields.qux.digits = [16, 3];
|
||||
await makeView({
|
||||
type: "list",
|
||||
resModel: "foo",
|
||||
serverData,
|
||||
arch: '<tree><field name="qux"/></tree>',
|
||||
groupBy: ["bar"],
|
||||
});
|
||||
const [td1, td2] = target.querySelectorAll("td.o_list_number");
|
||||
assert.strictEqual(td1.textContent, "9.000");
|
||||
assert.strictEqual(td2.textContent, "10.400");
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("list view does not crash when clicked button cell", async function (assert) {
|
||||
await makeView({
|
||||
@@ -17888,7 +17895,7 @@ QUnit.module("Views", (hooks) => {
|
||||
|
||||
await click(target, ".o_data_row:nth-child(1) td.o_list_many2one");
|
||||
await click(target, ".o_field_many2one_selection .o-autocomplete--input");
|
||||
await clickOpenedDropdownItem(target, "m2o", "Search More...");
|
||||
await clickOpenedDropdownItem(target, "m2o", "View all");
|
||||
|
||||
assert.verifySteps([]);
|
||||
|
||||
@@ -19000,7 +19007,7 @@ QUnit.module("Views", (hooks) => {
|
||||
const items = Array.from(
|
||||
target.querySelectorAll(".o_selected_row .o_field_many2many_tags .dropdown-item")
|
||||
);
|
||||
await click(items.find((el) => el.textContent.trim() === "Search More..."));
|
||||
await click(items.find((el) => el.textContent.trim() === "View all"));
|
||||
assert.verifySteps([
|
||||
`bar: get_views: {"lang":"en","uid":7,"tz":"taht"}`,
|
||||
`bar: web_search_read: {"lang":"en","uid":7,"tz":"taht","bin_size":true}`,
|
||||
@@ -19014,16 +19021,16 @@ QUnit.module("Views", (hooks) => {
|
||||
|
||||
QUnit.test("search nested many2one field with early option selection", async (assert) => {
|
||||
const deferred = makeDeferred();
|
||||
serverData.models.parent = {
|
||||
(serverData.models.parent = {
|
||||
fields: {
|
||||
foo: { string: "Foo", type: "one2many", relation: "foo" },
|
||||
},
|
||||
},
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "parent",
|
||||
serverData,
|
||||
arch: `
|
||||
}),
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "parent",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="foo">
|
||||
<tree editable="bottom">
|
||||
@@ -19031,30 +19038,29 @@ QUnit.module("Views", (hooks) => {
|
||||
</tree>
|
||||
</field>
|
||||
</form>`,
|
||||
mockRPC: async (route, { method }) => {
|
||||
if (method === "name_search") {
|
||||
await deferred;
|
||||
}
|
||||
},
|
||||
});
|
||||
mockRPC: async (route, { method }) => {
|
||||
if (method === "name_search") {
|
||||
await deferred;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
await triggerEvent(document.querySelector('.o_field_x2many_list_row_add a'), null, "click");
|
||||
await triggerEvent(document.querySelector(".o_field_x2many_list_row_add a"), null, "click");
|
||||
|
||||
const input = document.activeElement;
|
||||
input.value = 'alu';
|
||||
triggerEvent(document.activeElement, null, "input"),
|
||||
await nextTick();
|
||||
input.value = "alu";
|
||||
triggerEvent(document.activeElement, null, "input"), await nextTick();
|
||||
|
||||
input.value = 'alue';
|
||||
input.value = "alue";
|
||||
triggerEvent(document.activeElement, null, "input"),
|
||||
triggerHotkey("Enter"),
|
||||
await nextTick();
|
||||
triggerHotkey("Enter"),
|
||||
await nextTick();
|
||||
|
||||
deferred.resolve();
|
||||
await nextTick();
|
||||
|
||||
assert.strictEqual(input, document.activeElement);
|
||||
assert.strictEqual(input.value, 'Value 1');
|
||||
assert.strictEqual(input.value, "Value 1");
|
||||
});
|
||||
QUnit.test("monetary field display for rtl languages", async function (assert){
|
||||
patchWithCleanup(localization, {
|
||||
|
||||
Reference in New Issue
Block a user