[FIX] web: one2many in kanban can remove a new record
Have a one2many in a form view. It displays its records with a kanban. Add a record, now click on that new record. Before this commit, there was not "Remove" button, preventing to effectively remove a new (virtual at this point) record from the one2many. Aftet this commit, there is a remove button that effectively removes the record from the one2many. closes odoo/odoo#97775 Signed-off-by: FrancoisGe <fge@odoo.com>
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
<button class="btn btn-primary o_form_button_save" t-on-click="save" data-hotkey="c">Save & Close</button>
|
||||
<button class="btn btn-primary o_form_button_save_new" t-on-click="saveAndNew" data-hotkey="n">Save & New</button>
|
||||
<button class="btn btn-secondary o_form_button_cancel" t-on-click="discard" data-hotkey="j">Discard</button>
|
||||
<t t-if="props.delete">
|
||||
<button class="btn btn-secondary o_btn_remove" t-on-click="remove" data-hotkey="k">Remove</button>
|
||||
</t>
|
||||
</t>
|
||||
<t t-elif="record.isInEdition">
|
||||
<button class="btn btn-primary o_form_button_save" t-on-click="save" data-hotkey="c">Save</button>
|
||||
|
||||
@@ -12325,4 +12325,48 @@ QUnit.module("Fields", (hooks) => {
|
||||
assert.containsN(target, ".o_list_renderer tbody tr", 4);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("one2many can delete a new record", async (assert) => {
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
serverData,
|
||||
arch: `
|
||||
<form>
|
||||
<field name="p">
|
||||
<kanban>
|
||||
<field name="foo"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_global_click_edit"><t t-esc="record.foo.value"/></div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
<form>
|
||||
<field name="foo" />
|
||||
</form>
|
||||
</field>
|
||||
</form>`,
|
||||
resId: 1,
|
||||
mockRPC(route, args) {
|
||||
if (args.method === "write") {
|
||||
assert.step("write"); // should not happen
|
||||
}
|
||||
},
|
||||
});
|
||||
await clickEdit(target);
|
||||
assert.containsNone(target, ".o_kanban_record:not(.o_kanban_ghost)");
|
||||
|
||||
await click(target, ".o-kanban-button-new");
|
||||
await clickSave(target.querySelector(".modal"));
|
||||
assert.containsOnce(target, ".o_kanban_record:not(.o_kanban_ghost)");
|
||||
|
||||
await click(target, ".o_kanban_record:not(.o_kanban_ghost)");
|
||||
assert.containsOnce(target, ".modal .o_btn_remove");
|
||||
|
||||
await click(target, ".modal .o_btn_remove");
|
||||
assert.containsNone(target, ".o_kanban_record:not(.o_kanban_ghost)");
|
||||
|
||||
await clickSave(target);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user