[IMP] web: edit domain button is available while loading records count
This commit removes the requirement that the records count should be set before the edit domain button is shown for domains which must be edited in a dialog. This could be annoying in cases the records count loads slowly. task-3561782 closes odoo/odoo#139969 X-original-commit: f2ba825eac5e4bda3d1b1d3676a1b737701c0fb8 Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com> Signed-off-by: Julien Carion (juca) <juca@odoo.com>
This commit is contained in:
@@ -77,10 +77,9 @@
|
||||
t-on-click="() => this.checkProps()"
|
||||
/>
|
||||
</t>
|
||||
|
||||
<t t-if="props.editInDialog and !props.readonly">
|
||||
<button class="btn btn-sm btn-primary o_field_domain_dialog_button" t-on-click.prevent="onEditDialogBtnClick">Edit Domain</button>
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="props.editInDialog and !props.readonly">
|
||||
<button class="btn btn-sm btn-primary o_field_domain_dialog_button" t-on-click.prevent="onEditDialogBtnClick">Edit Domain</button>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -954,6 +954,45 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.containsOnce(target, ".modal", "the domain is invalid: the dialog is not closed");
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"edit domain button is available even while loading records count",
|
||||
async function (assert) {
|
||||
serverData.models.partner.fields.display_name.default = "[]";
|
||||
patchWithCleanup(odoo, {
|
||||
debug: true,
|
||||
});
|
||||
const searchCountDeffered = makeDeferred();
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="display_name" widget="domain" options="{'model': 'partner', 'in_dialog': True}"/>
|
||||
</form>`,
|
||||
mockRPC: async (route) => {
|
||||
if (route === "/web/dataset/call_kw/partner/search_count") {
|
||||
await searchCountDeffered;
|
||||
}
|
||||
if (route === "/web/domain/validate") {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
});
|
||||
assert.containsNone(target, ".modal");
|
||||
assert.containsOnce(target, ".o_field_domain_dialog_button");
|
||||
await click(target, ".o_field_domain_dialog_button");
|
||||
searchCountDeffered.resolve();
|
||||
assert.containsOnce(target, ".modal");
|
||||
await click(target, ".modal-footer .btn-primary");
|
||||
assert.containsNone(target, ".modal");
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_domain_show_selection_button").textContent,
|
||||
"5 record(s) "
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"quick check on save if domain has been edited via the debug input",
|
||||
async function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user