This commit is contained in:
2026-11-08 17:43:44 +08:00
parent 974a1fb10b
commit 3b5af1e3a6
483 changed files with 590466 additions and 0 deletions

View File

@@ -0,0 +1,356 @@
import { expect, resize, test } from "@odoo/hoot";
import { advanceTime } from "@odoo/hoot-mock";
import {
click,
contains,
mailModels,
} from "@mail/../tests/mail_test_helpers";
import {
defineModels,
getService,
mountWithCleanup,
onRpc,
patchWithCleanup,
} from "@web/../tests/web_test_helpers";
import { WebClient } from "@web/webclient/webclient";
import { download } from "@web/core/network/download";
// Due to dependency with mail module, we have to define their models for our tests.
defineModels(mailModels);
const getOptionMockResponse = {
"companies": [],
"variants_source_id": 14,
"has_inactive_variants": false,
"available_variants": [],
"selected_variant_id": 14,
"sections_source_id": 14,
"sections": [],
"has_inactive_sections": false,
"report_id": 14,
"date": {
"string": "2025",
"period_type": "year",
"date_from": "2025-01-01",
"date_to": "2025-12-31",
"default_opening_date": "this_year"
},
"filter_date": {
"filters": {
"month": {
"key": "month",
"start_day": 1,
"start_month": 1,
"months_per_period": 1,
},
"quarter": {
"key": "quarter",
"start_day": 1,
"start_month": 1,
"months_per_period": 3,
},
"year": {
"key": "year",
"start_day": 1,
"start_month": 1,
"months_per_period": 12,
},
}
},
"available_horizontal_groups": [],
"selected_horizontal_group_id": null,
"account_type": [],
"all_entries": false,
"aml_ir_filters": [],
"buttons": [],
"export_mode": null,
"hide_0_lines": false,
"multi_currency": false,
"partner": false,
"partner_categories": [],
"selected_partner_ids": [],
"partner_ids": [],
"selected_partner_categories": [],
"unreconciled": false,
"rounding_unit": "decimals",
"rounding_unit_names": {
"decimals": ".$",
},
"search_bar": false,
"unfold_all": false,
"unfolded_lines": [],
"column_headers": [],
"columns": [
{
"name": "A column",
"column_group_index": 0,
"expression_label": "a_column",
"sortable": false,
"figure_type": "string",
"blank_if_zero": false,
"style": ""
},
],
"column_groups": {0: {"forced_options": {}, "forced_domain": []}
},
"custom_display_config": {},
"filters": {},
"user_groups": {},
};
const getReportInformationMockResponse = {
"caret_options": {},
"column_headers_render_data": {"level_colspan": [1], "level_repetitions": [1], "custom_subheaders": []},
"column_groups_totals": {0: {}},
"context": {},
"annotations": {},
"lines": [
{
"id": "~account.report~14|~res.partner~1",
"name": "A partner",
"columns": [
{
"auditable": false,
"blank_if_zero": false,
"column_group_index": 0,
"currency": null,
"currency_symbol": "",
"digits": 1,
"expression_label": "a_column",
"figure_type": "string",
"green_on_positive": false,
"has_sublines": false,
"is_zero": false,
"name": "",
"no_format": null,
"report_line_id": null,
"sortable": false
},
],
"level": 1,
"trust": "normal",
"unfoldable": true,
"unfolded": false,
"expand_function": "some_expand_function"
},
],
"warnings": {},
"report": { "company_name": "YourCompany", "company_country_code": "US", "company_currency_symbol": "$", "name": "A report", "root_report_id": "account.report()"}
};
const getExpandedLinesMockResponse = [
{
"id": "~account.report~14|~res.partner~1|0~account.move.line~1",
"parent_id": "~account.report~14|~res.partner~1",
"name": "first move line",
"columns": [
{
"auditable": false,
"blank_if_zero": false,
"column_group_index": 0,
"currency": null,
"currency_symbol": "$",
"digits": 1,
"expression_label": "a_column",
"figure_type": "string",
"green_on_positive": false,
"has_sublines": false,
"is_zero": false,
"name": "first value",
"no_format": "first value",
"report_line_id": null,
"sortable": false
},
],
"level": 3
},
{
"id": "~account.report~14|~res.partner~1|0~account.move.line~11",
"parent_id": "~account.report~14|~res.partner~1",
"name": "second move line",
"columns": [
{
"auditable": false,
"blank_if_zero": false,
"column_group_index": 0,
"currency": null,
"currency_symbol": "$",
"digits": 1,
"expression_label": "a_column",
"figure_type": "string",
"green_on_positive": false,
"has_sublines": false,
"is_zero": false,
"name": "second value",
"no_format": "second value",
"report_line_id": null,
"sortable": false
},
],
"level": 3
},
];
test("Test unfold loaded line", async() => {
async function mockRpcReport({ method, model }) {
if (model === 'account.report') {
if (method === 'get_options') {
return getOptionMockResponse;
}
if (method === 'get_report_information') {
return getReportInformationMockResponse;
}
if (method === 'get_expanded_lines') {
mockRpcReport.getExpandedLineCallCount = (mockRpcReport.getExpandedLineCallCount || 0) + 1;
return getExpandedLinesMockResponse;
}
if (method === "get_annotations_from_client") {
return [];
}
}
}
onRpc(mockRpcReport);
await mountWithCleanup(WebClient);
await getService("action").doAction({
type: "ir.actions.client",
tag: "account_report",
params: {},
})
await click(".btn_foldable");
await contains(".unfolded", { count: 1 });
await click(".btn_foldable");
await contains(".unfolded", { count: 0 });
await click(".btn_foldable");
await contains(".unfolded", { count: 1 });
// Only one call to get_expanded_lines, as we unfolded/folded/unfolded the same line
expect(mockRpcReport.getExpandedLineCallCount).toEqual(1);
});
test("can execute account report download actions", async function () {
patchWithCleanup(download, {
_download: async ({ url, data }) => {
expect.step(url);
expect(data).toEqual(
{
model: "some_model",
options: {
someOption: true,
},
output_format: "pdf",
},
{ message: "should give the correct data" }
);
return Promise.resolve();
},
});
await mountWithCleanup(WebClient);
await getService("action").doAction({
data: {
model: "some_model",
options: {
someOption: true,
},
output_format: "pdf",
},
type: "ir_actions_account_report_download",
});
expect.verifySteps(["/account_reports"]);
});
test("make sure the virtual grid is somewhat working", async () => {
async function mockRpcReport({ method, model }) {
if (model === 'account.report') {
if (method === 'get_options') {
return getOptionMockResponse;
}
if (method === 'get_report_information') {
return getReportInformationMockResponse;
}
if (method === 'get_expanded_lines') {
// duplicate the lines 100 times to get 200 lines so the scrolling has some effect.
return getExpandedLinesMockResponse.flatMap(line => {
const copies = [];
for (let i = 0; i < 100; i++) {
copies.push({
...line,
id: line.id + "_" + i,
name: line.name + " " + i,
});
}
return copies;
});
}
if (method === "get_annotations_from_client") {
return [];
}
}
}
onRpc(mockRpcReport);
await mountWithCleanup(WebClient);
await getService("action").doAction({
type: "ir.actions.client",
tag: "account_report",
params: {},
});
await click(".btn_foldable");
await contains(".unfolded", { count: 1 });
expect(document.querySelectorAll('tr[data-id="line"]').length).toBeLessThan(100, { message: "should not have rendered all the lines of the report" });
expect(':nth-child(1 of tr:not(.o_hidden)[data-id="line"])').toHaveText("A partner");
await contains(':nth-child(2 of tr:not(.o_hidden)[data-id="line"])');
// prevent the window size to be the height of the table.
await resize({ height: 800 });
// wait for the resize event to fire, and the virtual grid to recompute (500 should be enough as it takes ~50ms in reality)
await advanceTime(500, { animationFrame: true });
let scrollContainer = document.querySelector(".o_account_report_scroll_container");
if ((await getService("ui")).isSmall) {
// On mobile, the scroll container changes since the layout change.
scrollContainer = document.querySelector(".account_report");
}
const tbody = scrollContainer.querySelector("tbody");
const topSpacer = tbody.querySelector("tr:first-child");
const bottomSpacer = tbody.querySelector("tr:last-child");
const getSpacerHeight = (el) => parseFloat(el.style.height) || 0;
expect(getSpacerHeight(topSpacer)).toBe(0, { message: "top spacer should be 0 at scroll top" });
expect(getSpacerHeight(bottomSpacer)).toBeGreaterThan(0, { message: "bottom spacer should account for unrendered lines below" });
scrollContainer.scrollTop = document.querySelector(':nth-last-child(1 of tr:not(.o_hidden)[data-id="line"])').offsetTop;
await advanceTime(500, { animationFrame: true });
expect(':nth-child(1 of tr:not(.o_hidden)[data-id="line"])').not.toHaveText("A partner");
expect(':nth-last-child(1 of tr:not(.o_hidden)[data-id="line"])').not.toHaveText("second move line 99 second value");
scrollContainer.scrollTop = scrollContainer.scrollHeight;
await advanceTime(500, { animationFrame: true });
expect(':nth-last-child(1 of tr:not(.o_hidden)[data-id="line"])').toHaveText("second move line 99 second value");
expect(getSpacerHeight(topSpacer)).toBeGreaterThan(0, { message: "top spacer should account for unrendered lines above" });
expect(getSpacerHeight(bottomSpacer)).toBe(0, { message: "bottom spacer should be 0 at scroll bottom" });
// Record the DOM rows at the bottom to verify they are reused (not recreated) when scrolling back up.
const rowsAtBottom = [...document.querySelectorAll('tr[data-id="line"]')];
scrollContainer.scrollTop = 0;
await advanceTime(500, { animationFrame: true });
expect(':nth-child(1 of tr:not(.o_hidden)[data-id="line"])').toHaveText("A partner");
expect(':nth-last-child(1 of tr:not(.o_hidden)[data-id="line"])').not.toHaveText("second move line 99 second value");
// The virtual grid reuses existing DOM rows rather than destroying and recreating them.
const rowsAtTop = [...document.querySelectorAll('tr[data-id="line"]')];
expect(rowsAtTop.length).toBe(rowsAtBottom.length, { message: "scrolling should not create or destroy DOM rows" });
const rowsAtTopSet = new Set(rowsAtTop);
for (const row of rowsAtBottom) {
expect(rowsAtTopSet.has(row)).toBe(true, { message: "every DOM row from the bottom should still be present at the top" });
}
});

View File

@@ -0,0 +1,650 @@
import { expect, test } from "@odoo/hoot";
import { waitFor } from "@odoo/hoot-dom";
import {
contains,
defineModels,
fields,
models,
mountView,
onRpc,
sortableDrag,
} from "@web/../tests/web_test_helpers";
import { defineMailModels } from "@mail/../tests/mail_test_helpers";
class Report extends models.Model {
_name = "report";
line_ids = fields.One2many({ relation: "report_lines", relation_field: "report_id" });
_records = [
{
id: 1,
line_ids: [1, 2, 3, 4, 5],
},
];
_views = {
form: /* xml */ `
<form>
<field class="w-100" name="line_ids" widget="account_report_lines_list_x2many">
<list>
<field name="id" column_invisible="1"/>
<field name="sequence" column_invisible="1"/>
<field name="parent_id" column_invisible="1"/>
<field name="hierarchy_level" column_invisible="1"/>
<field name="name"/>
<field name="code" optional="hide"/>
<field name="foldability" optional="hide"/>
</list>
</field>
</form>
`,
};
}
class ReportLines extends models.Model {
_name = "report_lines";
report_id = fields.Many2one({ relation: "report", string: "Report ID" });
sequence = fields.Integer();
parent_id = fields.Many2one({ relation: "report_lines", relation_field: "id" });
hierarchy_level = fields.Integer();
name = fields.Char();
code = fields.Char();
foldability = fields.Selection({
selection: [
["always_unfolded", "Always unfolded"],
["foldable", "Foldable"],
["never_unfolded", "Never unfolded"],
],
});
_records = [
{
id: 1,
parent_id: false,
hierarchy_level: 1,
name: "Root without children",
code: "RWOC",
foldability: "never_unfolded",
},
{
id: 2,
parent_id: false,
hierarchy_level: 0,
name: "Root with children",
code: "RC",
foldability: "always_unfolded",
},
{
id: 3,
parent_id: 2,
hierarchy_level: 3,
name: "Child #1",
code: "C1",
foldability: "always_unfolded",
},
{
id: 4,
parent_id: 3,
hierarchy_level: 5,
name: "Grandchild",
code: "GC",
foldability: "never_unfolded",
},
{
id: 5,
parent_id: 2,
hierarchy_level: 3,
name: "Child #2",
code: "C2",
foldability: "never_unfolded",
},
];
_views = {
form: `<form><field name="name"/></form>`,
};
}
defineModels([Report, ReportLines]);
defineMailModels();
//------------------------------------------------------------------------------------------------------------------
// Structure
//------------------------------------------------------------------------------------------------------------------
test("have correct descendants count", async () => {
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
expect(
".account_report_lines_list_x2many li[data-descendants_count='0'] span:contains('Root without children')"
).toHaveCount(1);
expect(
".account_report_lines_list_x2many li[data-descendants_count='3'] span:contains('Root with children')"
).toHaveCount(1);
expect(
".account_report_lines_list_x2many li[data-descendants_count='1'] span:contains('Child #1')"
).toHaveCount(1);
expect(
".account_report_lines_list_x2many li[data-descendants_count='0'] span:contains('Grandchild')"
).toHaveCount(1);
expect(
".account_report_lines_list_x2many li[data-descendants_count='0'] span:contains('Child #2')"
).toHaveCount(1);
});
//------------------------------------------------------------------------------------------------------------------
// Create
//------------------------------------------------------------------------------------------------------------------
test("can create a line", async () => {
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
await contains(".account_report_lines_list_x2many li:last-of-type a").click();
await waitFor(".o_dialog");
await contains("div[name='name'] input").edit("Created line");
await contains(".o_dialog .o_form_button_save").click();
await waitFor(".account_report_lines_list_x2many li span:contains('Created line')");
});
//------------------------------------------------------------------------------------------------------------------
// Edit
//------------------------------------------------------------------------------------------------------------------
test("can edit a line", async () => {
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
await contains(".account_report_lines_list_x2many li[data-record_id='1'] .column").click();
await waitFor(".o_dialog");
await contains("div[name='name'] input").edit("Line without children (edited)");
await contains(".o_dialog .o_form_button_save").click();
await waitFor(
".account_report_lines_list_x2many li span:contains('Line without children (edited)')"
);
});
//------------------------------------------------------------------------------------------------------------------
// Delete
//------------------------------------------------------------------------------------------------------------------
test("can delete a root", async () => {
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
await contains(
".account_report_lines_list_x2many li[data-record_id='1'] > div > .trash"
).click();
expect(
".account_report_lines_list_x2many li span:contains('Root without children')"
).toHaveCount(0);
expect(".account_report_lines_list_x2many li span:contains('Root with children')").toHaveCount(
1
);
expect(".account_report_lines_list_x2many li span:contains('Child #1')").toHaveCount(1);
expect(".account_report_lines_list_x2many li span:contains('Grandchild')").toHaveCount(1);
expect(".account_report_lines_list_x2many li span:contains('Child #2')").toHaveCount(1);
});
test("can delete a root with children", async () => {
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
await contains(
".account_report_lines_list_x2many li[data-record_id='2'] > div > .trash"
).click();
// Confirmation dialog "This line and all its children will be deleted. Are you sure you want to proceed?"
await waitFor(".o_dialog");
await contains(".o_dialog .btn-primary").click();
expect(
".account_report_lines_list_x2many li span:contains('Root without children')"
).toHaveCount(1);
expect(".account_report_lines_list_x2many li span:contains('Root with children')").toHaveCount(
0
);
expect(".account_report_lines_list_x2many li span:contains('Child #1')").toHaveCount(0);
expect(".account_report_lines_list_x2many li span:contains('Grandchild')").toHaveCount(0);
expect(".account_report_lines_list_x2many li span:contains('Child #2')").toHaveCount(0);
});
test("can delete a last child", async () => {
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
await contains(
".account_report_lines_list_x2many li[data-record_id='4'] > div > .trash"
).click();
expect(
".account_report_lines_list_x2many li span:contains('Root without children')"
).toHaveCount(1);
expect(
".account_report_lines_list_x2many li[data-descendants_count='2'] span:contains('Root with children')"
).toHaveCount(1);
expect(
".account_report_lines_list_x2many li[data-descendants_count='0'] span:contains('Child #1')"
).toHaveCount(1);
expect(".account_report_lines_list_x2many li span:contains('Grandchild')").toHaveCount(0);
expect(".account_report_lines_list_x2many li span:contains('Child #2')").toHaveCount(1);
});
//------------------------------------------------------------------------------------------------------------------
// Drag and drop
//------------------------------------------------------------------------------------------------------------------
test("can move a root down", async () => {
Report._records[0].line_ids = [1, 2, 3, 4];
ReportLines._records = [
{
id: 1,
parent_id: false,
hierarchy_level: 1,
name: "dragged",
code: "D",
foldability: "never_unfolded",
},
{
id: 2,
parent_id: false,
hierarchy_level: 1,
name: "noChild",
code: "N",
foldability: "never_unfolded",
},
{
id: 3,
parent_id: false,
hierarchy_level: 0,
name: "parent",
code: "P",
foldability: "always_unfolded",
},
{
id: 4,
parent_id: 3,
hierarchy_level: 3,
name: "child",
code: "C",
foldability: "never_unfolded",
},
];
onRpc("report", "web_save", (args) => {
expect.step("web_save");
const lineIds = args.args[1].line_ids;
// Parents
expect(lineIds[0][2].parent_id).toBe(3);
// Hierarchy levels
expect(lineIds[0][2].hierarchy_level).toBe(3);
// Sequences
expect(lineIds[0][2].sequence).toBe(4);
expect(lineIds[1][2].sequence).toBe(1);
expect(lineIds[2][2].sequence).toBe(2);
expect(lineIds[3][2].sequence).toBe(3);
});
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
const { drop, moveUnder } = await sortableDrag("li[data-record_id='1']");
await moveUnder("li[data-record_id='2']");
await moveUnder("li[data-record_id='4']");
await drop();
await contains(".o_form_button_save").click();
expect.verifySteps(["web_save"]);
});
test("can move a root up", async () => {
Report._records[0].line_ids = [1, 2, 3, 4];
ReportLines._records = [
{
id: 1,
parent_id: false,
hierarchy_level: 0,
name: "parent",
code: "P",
foldability: "always_unfolded",
},
{
id: 2,
parent_id: 1,
hierarchy_level: 3,
name: "child",
code: "C",
foldability: "never_unfolded",
},
{
id: 3,
parent_id: false,
hierarchy_level: 1,
name: "noChild",
code: "N",
foldability: "never_unfolded",
},
{
id: 4,
parent_id: false,
hierarchy_level: 1,
name: "dragged",
code: "D",
foldability: "never_unfolded",
},
];
onRpc("report", "web_save", (args) => {
expect.step("web_save");
const lineIds = args.args[1].line_ids;
// Parents
expect(lineIds[0][2].parent_id).toBe(1);
// Hierarchy levels
expect(lineIds[0][2].hierarchy_level).toBe(3);
// Sequences
expect(lineIds[0][2].sequence).toBe(2);
expect(lineIds[1][2].sequence).toBe(1);
expect(lineIds[2][2].sequence).toBe(3);
expect(lineIds[3][2].sequence).toBe(4);
});
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
const { drop, moveAbove } = await sortableDrag("li[data-record_id='4']");
await moveAbove("li[data-record_id='3']");
await moveAbove("li[data-record_id='2']");
await drop();
await contains(".o_form_button_save").click();
expect.verifySteps(["web_save"]);
});
test("can move a child down", async () => {
Report._records[0].line_ids = [1, 2, 3, 4];
ReportLines._records = [
{
id: 1,
parent_id: false,
hierarchy_level: 0,
name: "parent",
code: "P",
foldability: "always_unfolded",
},
{
id: 2,
parent_id: 1,
hierarchy_level: 3,
name: "dragged",
code: "D",
foldability: "never_unfolded",
},
{
id: 3,
parent_id: 1,
hierarchy_level: 3,
name: "child",
code: "C",
foldability: "never_unfolded",
},
{
id: 4,
parent_id: false,
hierarchy_level: 1,
name: "noChild",
code: "N",
foldability: "never_unfolded",
},
];
onRpc("report", "web_save", (args) => {
expect.step("web_save");
const lineIds = args.args[1].line_ids;
// Parents
expect(lineIds[0][2].parent_id).toBe(false);
// Hierarchy levels
expect(lineIds[0][2].hierarchy_level).toBe(1);
// Sequences
expect(lineIds[0][2].sequence).toBe(4);
expect(lineIds[1][2].sequence).toBe(1);
expect(lineIds[2][2].sequence).toBe(2);
expect(lineIds[3][2].sequence).toBe(3);
});
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
const { drop, moveUnder } = await sortableDrag("li[data-record_id='2']");
await moveUnder("li[data-record_id='3']");
await moveUnder("li[data-record_id='4']");
await drop();
await contains(".o_form_button_save").click();
expect.verifySteps(["web_save"]);
});
test("can move a child up", async () => {
Report._records[0].line_ids = [1, 2, 3];
ReportLines._records = [
{
id: 1,
parent_id: false,
hierarchy_level: 0,
name: "parent",
code: "P",
foldability: "always_unfolded",
},
{
id: 2,
parent_id: 1,
hierarchy_level: 3,
name: "child",
code: "C",
foldability: "never_unfolded",
},
{
id: 3,
parent_id: 1,
hierarchy_level: 3,
name: "dragged",
code: "D",
foldability: "never_unfolded",
},
];
onRpc("report", "web_save", (args) => {
expect.step("web_save");
const lineIds = args.args[1].line_ids;
// Parents
expect(lineIds[0][2].parent_id).toBe(false);
// Hierarchy levels
expect(lineIds[0][2].hierarchy_level).toBe(1);
// Sequences
expect(lineIds[0][2].sequence).toBe(1);
expect(lineIds[1][2].sequence).toBe(2);
expect(lineIds[2][2].sequence).toBe(3);
});
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
const { drop, moveAbove } = await sortableDrag("li[data-record_id='3']");
await moveAbove("li[data-record_id='2']");
await moveAbove("li[data-record_id='1']");
await drop();
await contains(".o_form_button_save").click();
expect.verifySteps(["web_save"]);
});
test("can move a new root into a child", async () => {
Report._records[0].line_ids = [1, 2, 3];
ReportLines._records = [
{
id: 1,
parent_id: false,
hierarchy_level: 0,
name: "parent",
code: "P",
foldability: "always_unfolded",
},
{
id: 2,
parent_id: 1,
hierarchy_level: 3,
name: "child",
code: "C",
foldability: "never_unfolded",
},
{
id: 3,
parent_id: false,
hierarchy_level: 1,
name: "noChild",
code: "N",
foldability: "never_unfolded",
},
];
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
await contains(".account_report_lines_list_x2many li:last-of-type a").click();
await contains("div[name='name'] input").edit("dragged");
await contains(".o_dialog .o_form_button_save").click();
const { drop, moveAbove } = await sortableDrag("li[data-record_id='4']");
await moveAbove("li[data-record_id='3']");
await moveAbove("li[data-record_id='2']");
await drop();
// Only assert web_save for the main form view, not for the dialog
onRpc("report", "web_save", (args) => {
expect.step("web_save");
const lineIds = args.args[1].line_ids;
// Parents
expect(lineIds[0][2].parent_id).toBe(1);
// Hierarchy levels
expect(lineIds[0][2].hierarchy_level).toBe(3);
// Sequences
expect(lineIds[0][2].sequence).toBe(2);
expect(lineIds[1][2].sequence).toBe(1);
expect(lineIds[2][2].sequence).toBe(3);
expect(lineIds[3][2].sequence).toBe(4);
});
await contains(".o_form_button_save").click();
expect.verifySteps(["web_save"]);
});
test("can move a child into a new root", async () => {
Report._records[0].line_ids = [];
ReportLines._records = [];
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
await contains(".account_report_lines_list_x2many li:last-of-type a").click();
await contains("div[name='name'] input").edit("parent");
await contains(".o_dialog .o_form_button_save").click();
await contains(".account_report_lines_list_x2many li:last-of-type a").click();
await contains("div[name='name'] input").edit("dragged");
await contains(".o_dialog .o_form_button_save").click();
const { drop } = await contains("li[data-record_id='2']").drag();
await drop("li[data-record_id='2']", { position: "right", relative: true });
// Only assert web_save for the main form view, not for the dialog
onRpc("report", "web_save", (args) => {
expect.step("web_save");
const lineIds = args.args[1].line_ids;
// Parents
expect(lineIds[0][2].parent_id).toBe(1);
// Hierarchy levels
expect(lineIds[0][2].hierarchy_level).toBe(3);
// Sequences
expect(lineIds[0][2].sequence).toBe(2);
expect(lineIds[1][2].sequence).toBe(1);
});
await contains(".o_form_button_save").click();
expect.verifySteps(["web_save"]);
});
test.tags("desktop");
test("can display and hide 'Code' column when toggled in optional fields", async () => {
await mountView({
type: "form",
resId: 1,
resModel: "report",
});
// Ensure `code` column is hidden by default
expect(".account_report_lines_list_x2many span.fw-bold.fixed:contains('Code')").toHaveCount(0);
// simulate toggling the `code` field to make it visible
await contains(".o-dropdown.dropdown-toggle").click();
await contains("input[name='code']").click();
// Check that the column is now visible
expect(".account_report_lines_list_x2many span.fw-bold.fixed:contains('Code')").toHaveCount(1);
// Toggle it back to hide and verify
await contains("input[name='code']").click();
expect(".account_report_lines_list_x2many span.fw-bold.fixed:contains('Code')").toHaveCount(0);
});

View File

@@ -0,0 +1,285 @@
import { AccountReportFilters } from "@account_reports/components/account_report/filters/filters";
import { defineMailModels } from "@mail/../tests/mail_test_helpers";
import { expect, test } from "@odoo/hoot";
import { animationFrame } from "@odoo/hoot-mock";
import { Component, Plugin, providePlugins, proxy, signal, usePlugin, xml } from "@odoo/owl";
import { contains, mountWithCleanup } from "@web/../tests/web_test_helpers";
// Due to dependency with mail module, we have to define their models for our tests.
defineMailModels();
test("can change the date filter by editing textually", async () => {
const date = proxy({
period_type: "month",
date_to: "2019-03-31",
date_from: "2019-03-01",
});
class AccountReportController extends Plugin {
filters = { show_period_comparison: false };
userGroups = {};
cachedUserGroups = {};
cachedFilterOptions = () => ({
available_horizontal_groups: [],
available_variants: [],
companies: [],
date: date,
filter_date: {
range_mode: true,
filters: {
month: {
key: "month",
start_day: 1,
start_month: 1,
months_per_period: 1,
},
quarter: {
key: "quarter",
start_day: 1,
start_month: 1,
months_per_period: 3,
},
year: {
key: "year",
start_day: 1,
start_month: 1,
months_per_period: 12,
custom_ranges: [
["2022-01-01", "2022-06-30", "FY 2022_1"],
["2022-07-01", "2022-12-31", "FY 2022_2"],
],
},
},
},
rounding_unit: "decimals",
rounding_unit_names: {
decimals: ".$",
},
});
reload = (optionPath, newOptions) => {
expect.step(`reload ${optionPath} to ${newOptions}`);
};
updateOption = (option, value) => {
if (option === "date") {
expect.step(
`update option ${option} -> period_type: ${value.period_type} date_from: ${value.date_from} date_to: ${value.date_to}`
);
date.period_type = value.period_type;
date.date_from = value.date_from;
date.date_to = value.date_to;
}
};
getCacheKey = (sectionsSourceId, reportId) => `${sectionsSourceId}_${reportId}`;
loadingCallNumberByCacheKey = new Proxy(
{},
{
get(target, name) {
return name in target ? target[name] : 0;
},
set(target, name, newValue) {
target[name] = newValue;
return true;
},
}
);
revision = 0;
template = () => "account_reports.AccountReportFiltersCustomizable";
component = () => AccountReportFilters;
}
class AccountReportTestWrapper extends Component {
static template = xml`<AccountReportFilters/>`;
static components = { AccountReportFilters };
setup() {
providePlugins([AccountReportController]);
}
}
await mountWithCleanup(AccountReportTestWrapper);
// Default date = 2019-03-11
// Open Date Filter dropdown
await contains("#filter_date > button.o-dropdown").click();
// Click the Month input when selected
await contains(".date_filter_month.selected .input_current_date").click();
// Edit the month by changing the text (+14 months)
await contains(".date_filter_month .input_current_date:not([readonly])").edit("May 2020", {
confirm: "tab",
});
// Click the Month input when selected
await contains(".date_filter_month.selected .input_current_date").click();
// Edit the month by changing the text (-10 months)
await contains(".date_filter_month .input_current_date:not([readonly])").edit("May 2018", {
confirm: "tab",
});
// Click the Month input when selected
await contains(".date_filter_month.selected .input_current_date").click();
// Edit the month by changing the text to something invalid
await contains(".date_filter_month .input_current_date:not([readonly])").edit("Invalid Month", {
confirm: "tab",
});
// Select the Quarter filter
await contains(".date_filter_quarter").click();
// Click the Quarter input when selected
await contains(".date_filter_quarter.selected .input_current_date").click();
// Edit the quarter by changing the text (+5 quarters)
await contains(".date_filter_quarter .input_current_date:not([readonly])").edit(
"Apr - Jun 2020",
{ confirm: "tab" }
);
// Click the Quarter input when selected
await contains(".date_filter_quarter.selected .input_current_date").click();
// Edit the quarter by changing the text (-3 quarters)
await contains(".date_filter_quarter .input_current_date:not([readonly])").edit(
"Apr - Jun 2018",
{ confirm: "tab" }
);
// Click the Quarter input when selected
await contains(".date_filter_quarter.selected .input_current_date").click();
// Edit the quarter by changing the text (invalid quarter, -4 quarters)
await contains(".date_filter_quarter .input_current_date:not([readonly])").edit(
"Random - Feb 2018",
{ confirm: "tab" }
);
// Click the Quarter input when selected
await contains(".date_filter_quarter.selected .input_current_date").click();
// Edit the quarter by changing the text to something invalid
await contains(".date_filter_quarter .input_current_date:not([readonly])").edit(
"Invalid Quarter",
{ confirm: "tab" }
);
// Select the Year filter
await contains(".date_filter_year").click();
// Click the Year input when selected
await contains(".date_filter_year.selected .input_current_date").click();
// Edit the year by changing the text (+2 years)
await contains(".date_filter_year .input_current_date:not([readonly])").edit("2021", {
confirm: "tab",
});
// Click the Year input when selected
await contains(".date_filter_year.selected .input_current_date").click();
// Edit the year by changing the text (-1 year)
await contains(".date_filter_year .input_current_date:not([readonly])").edit("2018", {
confirm: "tab",
});
// Click the Year input when selected
await contains(".date_filter_year.selected .input_current_date").click();
// Edit the year by changing the text to something invalid
await contains(".date_filter_year .input_current_date:not([readonly])").edit("Invalid Year", {
confirm: "tab",
});
// Check for custom ranges
// Click the Year input when selected
await contains(".date_filter_year.selected .input_current_date").click();
// Edit the year by changing the text to something invalid
await contains(".date_filter_year .input_current_date:not([readonly])").edit("FY 2022_1");
// Click the Year input when selected
await contains(".date_filter_year.selected .input_current_date").click();
// Edit the year by changing the text to something invalid
await contains(".date_filter_year .input_current_date:not([readonly])").edit("FY 2022_2");
expect.verifySteps([
// Set the period to May 2020
"update option date -> period_type: month date_from: 2020-05-01 date_to: 2020-05-31",
// Set the period to May 2018
"update option date -> period_type: month date_from: 2018-05-01 date_to: 2018-05-31",
// Keep the month the same after entering an invalid value
// Switch to Quarter
"update option date -> period_type: quarter date_from: 2019-01-01 date_to: 2019-03-31",
// Set the quarter to +5 quarters
"update option date -> period_type: quarter date_from: 2020-04-01 date_to: 2020-06-30",
// Set the quarter to -3 quarters
"update option date -> period_type: quarter date_from: 2018-04-01 date_to: 2018-06-30",
// Set the quarter to -4 quarters
"update option date -> period_type: quarter date_from: 2018-01-01 date_to: 2018-03-31",
// Keep the quarter the same after entering an invalid value
// Switch to Year
"update option date -> period_type: year date_from: 2019-01-01 date_to: 2019-12-31",
// // Set the year to +2 years
"update option date -> period_type: year date_from: 2021-01-01 date_to: 2021-12-31",
// // Set the year to -1 year
"update option date -> period_type: year date_from: 2018-01-01 date_to: 2018-12-31",
// Keep the year the same after entering an invalid value
//Custom range FY 2022_1
"update option date -> period_type: year date_from: 2022-01-01 date_to: 2022-06-30",
//Custom range FY 2022_2
"update option date -> period_type: year date_from: 2022-07-01 date_to: 2022-12-31",
]);
});
test("date filter is reset when the report changes", async () => {
const filterOptions = {
report_id: 1,
available_horizontal_groups: [],
available_variants: [],
date: {
period_type: "month",
date_to: "2026-06-30",
date_from: "2026-06-01",
},
filter_date: {
range_mode: false,
filters: {
month: { key: "month", start_day: 1, start_month: 1, months_per_period: 1 },
},
},
rounding_unit: "decimals",
rounding_unit_names: { decimals: ".$" },
};
class AccountReportController extends Plugin {
filters = { show_period_comparison: false };
cachedUserGroups = {};
cachedFilterOptions = signal(proxy(filterOptions));
reload = () => {};
updateOption = () => {};
getCacheKey = () => "key";
loadingCallNumberByCacheKey = {};
template = () => "account_reports.AccountReportFiltersCustomizable";
component = () => AccountReportFilters;
}
class AccountReportTestWrapper extends Component {
static template = xml`<AccountReportFilters/>`;
static components = { AccountReportFilters };
setup() {
providePlugins([AccountReportController]);
this.controller = usePlugin(AccountReportController);
}
}
const filters = await mountWithCleanup(AccountReportTestWrapper);
// Move report 1 date filter March 2024 -> April 2024.
await contains("#filter_date > button.o-dropdown").click();
expect(".date_filter_month .input_current_date").toHaveValue("June 2026");
await contains(".date_filter_month .btn_next_date").click();
expect(".date_filter_month .input_current_date").toHaveValue("July 2026");
// Switching to another report must reset the date filter to that report's date.
filters.controller.cachedFilterOptions().report_id = 2;
await animationFrame();
expect(".date_filter_month .input_current_date").toHaveValue("June 2026");
});

View File

@@ -0,0 +1,131 @@
import { expect, test } from "@odoo/hoot";
import { click, press } from "@odoo/hoot-dom";
import { animationFrame } from "@odoo/hoot-mock";
import { Component, Plugin, providePlugins, signal, xml, useProps } from "@odoo/owl";
import { mountWithCleanup, defineModels } from "@web/../tests/web_test_helpers";
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { AccountReportLineCellEditable } from "@account_reports/components/account_report/line_cell_editable/line_cell_editable";
// Due to dependency with mail module, we have to define their models for our tests.
defineModels(mailModels);
class AccountReportController extends Plugin {
options = {};
scheduleClassUpdate = () => {};
}
class AccountReportLineCellEditableTestWrapper extends Component {
static template = xml`<AccountReportLineCellEditable t-props="this.props"/>`;
static components = { AccountReportLineCellEditable };
props = useProps([ "cell", "line", "cellIndex" ]);
setup() {
providePlugins([AccountReportController]);
}
}
test("can unformat a value when focus and format when blur", async () => {
await mountWithCleanup(AccountReportLineCellEditableTestWrapper, {
props: {
cell: {
name: signal("5,702.22"),
no_format: signal(5702.22),
edit_popup_data: signal("{}"),
figure_type: signal("float"),
},
cellIndex: 0,
line: {},
},
});
expect(".o_input").toHaveValue("5,702.22");
await click("[data-icon='edit']");
await animationFrame();
expect(".o_input").toHaveValue("5702.22");
await press("Enter");
await animationFrame();
expect(".o_input").toHaveValue("5,702.22");
});
test("can display boolean value", async () => {
await mountWithCleanup(AccountReportLineCellEditableTestWrapper, {
props: {
cell: {
name: signal("No"),
no_format: signal(0),
edit_popup_data: signal("{}"),
figure_type: signal("boolean"),
},
cellIndex: 0,
line: {},
},
});
expect(".o_input").toHaveValue("No");
});
test("can display a date value", async () => {
await mountWithCleanup(AccountReportLineCellEditableTestWrapper, {
props: {
cell: {
name: signal("2026-02-12T00:00:00.000+01:00"),
no_format: signal("2026-02-12T00:00:00.000+01:00"),
edit_popup_data: signal("{}"),
figure_type: signal("date"),
},
cellIndex: 0,
line: {},
},
});
expect(".o_input").toHaveValue("02/12/2026");
});
test("can display a datetime value in UTC", async () => {
await mountWithCleanup(AccountReportLineCellEditableTestWrapper, {
props: {
cell: {
name: signal("2026-02-12T10:00:00.000Z"),
no_format: signal("2026-02-12T10:00:00.000Z"),
edit_popup_data: signal("{}"),
figure_type: signal("datetime"),
},
cellIndex: 0,
line: {},
},
});
expect(".o_input").toHaveValue("02/12/2026 10:00:00");
});
test("can display a datetime value in UTC +1 and datetime in UTC +1", async () => {
AccountReportController.prototype.context = { tz: "Europe/Brussels" };
await mountWithCleanup(AccountReportLineCellEditableTestWrapper, {
props: {
cell: {
name: signal("2026-02-12T10:00:00.000+01:00"),
no_format: signal("2026-02-12T10:00:00.000+01:00"),
edit_popup_data: signal("{}"),
figure_type: signal("datetime"),
},
cellIndex: 0,
line: {},
},
});
expect(".o_input").toHaveValue("02/12/2026 10:00:00");
});
test("can display a datetime value in UTC +1 but datetime in UTC", async () => {
AccountReportController.prototype.context = { tz: "Europe/Brussels" };
await mountWithCleanup(AccountReportLineCellEditableTestWrapper, {
props: {
cell: {
name: signal("2026-02-12T10:00:00.000Z"),
no_format: signal("2026-02-12T10:00:00.000Z"),
edit_popup_data: signal("{}"),
figure_type: signal("datetime"),
},
cellIndex: 0,
line: {},
},
});
expect(".o_input").toHaveValue("02/12/2026 11:00:00");
});

View File

@@ -0,0 +1,162 @@
import { expect, test } from "@odoo/hoot";
import { animationFrame } from "@odoo/hoot-mock";
import { Component, Plugin, providePlugins, useProps, xml } from "@odoo/owl";
import { defineModels, mountWithCleanup } from "@web/../tests/web_test_helpers";
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { AccountReportSearchBar } from "@account_reports/components/account_report/search_bar/search_bar";
defineModels(mailModels);
async function typeSearch(text) {
const input = document.querySelector(".o_searchview_input");
input.value = text;
input.dispatchEvent(new InputEvent("input", { bubbles: true }));
await animationFrame();
}
function makeControllerWrapper(lines) {
class AccountReportController extends Plugin {
reportLoadingPromise = Promise.resolve();
lines = lines;
updateOption(key, value) { expect.step(`updateOption:${key}:${value}`); }
deleteOption(key) { expect.step(`deleteOption:${key}`); }
invalidateVisibleLines() { expect.step("invalidateVisibleLines"); }
}
class SearchBarWrapper extends Component {
static template = xml`<AccountReportSearchBar t-props="this.props"/>`;
static components = { AccountReportSearchBar };
props = useProps();
setup() {
providePlugins([AccountReportController]);
}
}
return SearchBarWrapper;
}
test("non-matching lines get search_match set to false", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Revenue", level: 0 },
{ id: "~account.report~0|~account.report.line~2", name: "Expenses", level: 0 },
];
await mountWithCleanup(makeControllerWrapper(lines));
await typeSearch("revenue");
expect(lines[0].search_match).toBe(true);
expect(lines[1].search_match).toBe(false);
expect.verifySteps(["updateOption:filter_search_bar:revenue", "invalidateVisibleLines"]);
});
test("search is case-insensitive", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Revenue", level: 0 },
{ id: "~account.report~0|~account.report.line~2", name: "Expenses", level: 0 },
];
await mountWithCleanup(makeControllerWrapper(lines));
await typeSearch("REVENUE");
expect(lines[0].search_match).toBe(true);
expect(lines[1].search_match).toBe(false);
expect.verifySteps(["updateOption:filter_search_bar:REVENUE", "invalidateVisibleLines"]);
});
test("partial query matches substrings in line names", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Product Sales", level: 0 },
{ id: "~account.report~0|~account.report.line~2", name: "Service Revenue", level: 0 },
{ id: "~account.report~0|~account.report.line~3", name: "Expenses", level: 0 },
];
await mountWithCleanup(makeControllerWrapper(lines));
await typeSearch("Sales");
expect(lines[0].search_match).toBe(true);
expect(lines[1].search_match).toBe(false);
expect(lines[2].search_match).toBe(false);
expect.verifySteps(["updateOption:filter_search_bar:Sales", "invalidateVisibleLines"]);
});
test("empty query sets all lines as matching and removes filter option", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Revenue", level: 0 },
{ id: "~account.report~0|~account.report.line~2", name: "Expenses", level: 0 },
];
await mountWithCleanup(makeControllerWrapper(lines));
// Apply a non-empty search first to put some lines in a non-matching state.
await typeSearch("revenue");
expect(lines[0].search_match).toBe(true);
expect(lines[1].search_match).toBe(false);
// Clearing the input resets every line to visible.
await typeSearch("");
expect(lines[0].search_match).toBe(true);
expect(lines[1].search_match).toBe(true);
expect.verifySteps([
"updateOption:filter_search_bar:revenue",
"invalidateVisibleLines",
"deleteOption:filter_search_bar",
"invalidateVisibleLines",
]);
});
test("child match makes ancestor lines visible", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Parent", level: 0 },
{ id: '~account.report~0|~account.report.line~1|{"groupby": "fake"}~res.fake~1', name: "Child Match", level: 1 },
{ id: "~account.report~0|~account.report.line~2", name: "Unrelated", level: 0 },
];
await mountWithCleanup(makeControllerWrapper(lines));
await typeSearch("child");
expect(lines[0].search_match).toBe(true); // Parent becomes visible
expect(lines[1].search_match).toBe(true); // Matched line
expect(lines[2].search_match).toBe(false); // Unrelated top-level sibling
expect.verifySteps(["updateOption:filter_search_bar:child", "invalidateVisibleLines"]);
});
test("parent match makes all descendant lines visible", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Parent Match", level: 0 },
{ id: '~account.report~0|~account.report.line~1|{"groupby": "fake"}~res.fake~1', name: "Child", level: 1 },
{ id: '~account.report~0|~account.report.line~1|{"groupby": "fake"}~res.fake~1|{"groupby": "fake2"}~res.fake2~1', name: "Grandchild", level: 2 },
{ id: "~account.report~0|~account.report.line~2", name: "Sibling", level: 0 },
];
await mountWithCleanup(makeControllerWrapper(lines));
await typeSearch("parent");
expect(lines[0].search_match).toBe(true); // Matched line
expect(lines[1].search_match).toBe(true); // Child carried down
expect(lines[2].search_match).toBe(true); // Grandchild carried down
expect(lines[3].search_match).toBe(false); // Same-level sibling stops propagation
expect.verifySteps(["updateOption:filter_search_bar:parent", "invalidateVisibleLines"]);
});
test("sibling of matched line does not inherit search_match", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Parent", level: 0 },
{ id: '~account.report~0|~account.report.line~1|{"groupby": "fake"}~res.fake~1', name: "Matching Child", level: 1 },
{ id: '~account.report~0|~account.report.line~1|{"groupby": "fake"}~res.fake~2', name: "Other Child", level: 1 },
];
await mountWithCleanup(makeControllerWrapper(lines));
await typeSearch("matching");
expect(lines[0].search_match).toBe(true); // Parent becomes visible
expect(lines[1].search_match).toBe(true); // Matched child
expect(lines[2].search_match).toBe(false); // Sibling at same level not matched
expect.verifySteps(["updateOption:filter_search_bar:matching", "invalidateVisibleLines"]);
});
test("initialQuery prop triggers search on mount", async () => {
const lines = [
{ id: "~account.report~0|~account.report.line~1", name: "Revenue", level: 0 },
{ id: "~account.report~0|~account.report.line~2", name: "Expenses", level: 0 },
];
await mountWithCleanup(makeControllerWrapper(lines), { props: { initialQuery: "revenue" } });
await animationFrame();
expect(lines[0].search_match).toBe(true);
expect(lines[1].search_match).toBe(false);
expect.verifySteps(["updateOption:filter_search_bar:revenue", "invalidateVisibleLines"]);
});

View File

@@ -0,0 +1,179 @@
import { registry } from "@web/core/registry";
function textLineIs(n, text) {
return {
trigger: `tr:nth-child(${n}) td:nth-child(2):text(${text})`,
};
}
registry.category("web_tour.tours").add("account_reports_tour", {
steps: () => [
//--------------------------------------------------------------------------------------------------------------
// Foldable
//--------------------------------------------------------------------------------------------------------------
{
content: "Initial foldable",
trigger: "table",
},
{
trigger: `tbody > tr[data-id=line]:not(.o_hidden):not(.empty):count(26)`,
},
{
content:
"Since the total line is not displayed (folded), the amount should be on the line",
trigger: `tr:nth-child(5) td:nth-child(2):text(75.00)`,
},
{
content: "Click to unfold line",
trigger: "tr:nth-child(5) td:first().unfoldable",
run: "click",
},
{
content: "Line is unfolded",
trigger: "tr:nth-child(6) td:nth-child(1):contains('101401')",
},
{
trigger: `tbody > tr[data-id=line]:not(.o_hidden):not(.empty):count(28)`,
},
{
content:
"Since the total line is displayed (unfolded), the amount should not be on the line",
trigger: `tr:nth-child(5) td:nth-child(2):text()`,
},
{
content: "Click to fold line",
trigger: "tr:nth-child(5) td:first().unfoldable",
run: "click",
},
{
content: "Line is folded",
trigger: "tr:nth-child(5) td:nth-child(2):text(75.00)",
},
{
trigger: "tbody > tr[data-id=line]:not(.o_hidden):not(.empty):count(26)",
},
//--------------------------------------------------------------------------------------------------------------
// Sortable
//--------------------------------------------------------------------------------------------------------------
{
content: "Unfold first line",
trigger: "tr:nth-child(5) td:first().unfoldable",
run: "click",
},
{
content: "Unfold second line",
trigger: "tr:nth-child(8) td:first().unfoldable",
run: "click",
},
{
content: "Unfold third line",
trigger: "tr:nth-child(11) td:first().unfoldable",
run: "click",
},
{
content: "Extra Trigger step",
trigger: "tr:nth-child(13):not(.d-none) td:nth-child(1):contains('101404')",
},
{
content: "Initial sortable",
trigger: "tr:nth-child(12) td:nth-child(2):text(100.00)",
},
textLineIs(6, "75.00"),
textLineIs(7, "75.00"),
textLineIs(9, "25.00"),
textLineIs(10, "25.00"),
textLineIs(12, "100.00"),
textLineIs(13, "50.00"),
textLineIs(14, "150.00"),
{
content: "Click sort",
trigger: "th .btn_sortable",
run: "click",
},
{
trigger: "tr:nth-child(12) td:nth-child(2):contains('50.00')",
},
{
content: "Unfold not previously unfolded line",
trigger: "tr:nth-child(23):contains('Current Liabilities') td:first().unfoldable",
run: "click",
},
{
content: "Line is unfolded",
trigger: "tr:nth-child(24) td:nth-child(1):contains('251000')",
run: "click",
},
textLineIs(6, "75.00"),
textLineIs(7, "75.00"),
textLineIs(9, "25.00"),
textLineIs(10, "25.00"),
textLineIs(12, "50.00"),
textLineIs(13, "100.00"),
textLineIs(14, "150.00"),
{
content: "Click sort",
trigger: "th .btn_sortable",
run: "click",
},
textLineIs(6, "75.00"),
textLineIs(7, "75.00"),
textLineIs(9, "25.00"),
textLineIs(10, "25.00"),
textLineIs(12, "100.00"),
textLineIs(13, "50.00"),
textLineIs(14, "150.00"),
{
content: "Click sort",
trigger: "th .btn_sortable",
run: "click",
},
textLineIs(6, "75.00"),
textLineIs(7, "75.00"),
textLineIs(9, "25.00"),
textLineIs(10, "25.00"),
textLineIs(12, "100.00"),
textLineIs(13, "50.00"),
textLineIs(14, "150.00"),
],
});
registry.category("web_tour.tours").add("account_reports_general_ledger_cumulated_balance", {
steps: () => [
{
content: "Open the journal Items of the Bank account",
trigger: "tr:has(td:nth-child(1):contains('4000')) .btn_action:contains('Journal Items'):not(:visible)",
run: "click",
},
{
content: "Open the optional columns dropdown",
trigger: "div.o_optional_columns button",
run: "click",
},
{
content: "Check the cumulated balance column",
trigger: ".o_popover span:has(input[name='cumulated_balance'])",
run: "click",
},
{
content: "Wait for the column to be visible",
trigger: "th[data-name='cumulated_balance']:visible",
},
{
content: "Check that the cumulated balance is correct on the move lines",
trigger: ".o_list_table",
run: async () => {
const amounts = document.querySelectorAll("td[name='cumulated_balance']");
const expectedAmounts = ["$ 30,000.00", "$ 29,000.00", "$ 27,500.00", "$ 25,500.00", "$ 23,000.00"];
for (let i = 0; i < amounts.length; i++) {
if (amounts[i].textContent !== expectedAmounts[i]) {
throw new Error(`Expected cumulated balance to be ${expectedAmounts[i]}, but got ${amounts[i].textContent}`);
}
}
if (amounts.length !== expectedAmounts.length) {
throw new Error(`Expected ${expectedAmounts.length} cumulated balance cells, but got ${amounts.length}`);
}
},
},
],
});

View File

@@ -0,0 +1,91 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add('account_reports_rounding_unit', {
steps: () => [
{
content: 'Test the value of `Receivables` line in decimals',
trigger: '.line_name:contains("Receivables") + .line_cell:contains("1,150,000.00")',
run: "click",
},
// Units
{
content: "Open amounts rounding dropdown",
trigger: "#filter_rounding_unit button",
run: 'click',
},
{
content: "Select the units filter",
trigger: ".dropdown-item:contains('In $')",
run: 'click',
},
{
trigger:
'.line_name:contains("Receivables") + .line_cell:not(:contains("1,150,000.00"))',
},
{
content: 'test the value of `Receivables` line in units',
// We wait for the value to change.
// We check the new value.
trigger: '.line_name:contains("Receivables") + .line_cell:contains("1,150,000")',
run: "click",
},
// Thousands
{
content: "Open amounts rounding dropdown",
trigger: "#filter_rounding_unit button",
run: 'click',
},
{
content: "Select the thousands filter",
trigger: ".dropdown-item:contains('In K$')",
run: 'click',
},
{
trigger: '.line_name:contains("Receivables") + .line_cell:not(:contains("1,150,000"))',
},
{
content: 'test the value of `Receivables` line in thousands',
// We wait for the value to change.
// We check the new value.
trigger: '.line_name:contains("Receivables") + .line_cell:contains("1,150")',
run: "click",
},
// Millions
{
content: "Open amounts rounding dropdown",
trigger: "#filter_rounding_unit button",
run: 'click',
},
{
content: "Select the millions filter",
trigger: ".dropdown-item:contains('In M$')",
run: 'click',
},
{
trigger: '.line_name:contains("Receivables") + .line_cell:not(:contains("1,150"))',
},
{
content: 'test the value of `Receivables` line in millions',
// We wait for the value to change.
// We check the new value.
trigger: '.line_name:contains("Receivables") + .line_cell:contains("1")',
run: "click",
},
// Decimals
{
content: "Open amounts rounding dropdown",
trigger: "#filter_rounding_unit button",
run: 'click',
},
{
content: "Select the decimals filter",
trigger: ".dropdown-item:contains('In .$')",
run: 'click',
},
{
content: 'test the value of `Receivables` line in millions',
trigger: '.line_name:contains("Receivables") + .line_cell:contains("1,150,000.00")',
run: () => null,
},
]
});

View File

@@ -0,0 +1,169 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("account_reports_annotations", {
steps: () => [
//--------------------------------------------------------------------------------------------------------------
// Annotations
//--------------------------------------------------------------------------------------------------------------
// Test the initial status of annotations - There are 2 annotations to display
{
content: "Initial annotations",
trigger: "body:has(.o_content):not(:has(.annotations)",
},
{
content: "Unfold first line",
trigger: "tr:nth-child(5) td:first()",
run: "click",
},
{
content: "Wait for the line to load",
trigger: "tr:nth-child(6).line_level_6"
},
{
content: "Unfold second line",
trigger: "tr:nth-child(8) td:first()",
run: "click",
},
{
content: "Wait for the line to load",
trigger: "tr:nth-child(9).line_level_6"
},
{
content: "Unfold third line",
trigger: "tr:nth-child(11) td:first()",
run: "click",
},
{
content: "Wait for the line to load",
trigger: "tr:nth-child(12).line_level_6"
},
{
content: "Extra Trigger step",
trigger: "tr:nth-child(6) .o_account_report_chatter_annotated",
},
{
content: "Extra Trigger step",
trigger: "tr:nth-child(13) .o_account_report_chatter_annotated",
},
{
content: "Check there are two lines annotated initially",
trigger: ".o_content:has(.btn_annotation.o_account_report_chatter_annotated:count(2))",
},
// Test that we can add a new annotation
{
content: "Click to show caret option",
trigger: "tr:nth-child(9) .btn_annotation:not(:visible)",
run: "click",
},
{
content: "Add a log note",
trigger: ".o-mail-Chatter-logNote",
run: "click",
},
{
content: "Add text to annotate",
trigger: ".o-mail-Composer-inputContainer textarea",
run: "edit Annotation 121000",
},
{
content: "Submit by logging the note",
trigger: ".o-mail-Composer-send",
run: "click",
},
{
content: "Close Chatter",
trigger: ".o_control_panel .btn-secondary[data-tooltip='Chatter']",
run: "click",
},
{
content: "Wait for annotation created",
trigger: "tr:nth-child(9) .o_account_report_chatter_annotated",
},
{
content: "Check there are now three lines annotated",
trigger: ".o_content:has(.btn_annotation.o_account_report_chatter_annotated:count(3))",
},
// Test that we can edit an annotation
{
content: "Open second annotated line annotation popover",
trigger: "tr:nth-child(9) .btn_annotation",
run: "click",
},
{
content: "Open the message actions menu",
trigger: ".o-mail-Message:last-child [title='Expand']:not(:visible)",
run: "click",
},
{
content: "Select the edit button",
trigger: ".o-mail-Message-moreMenu .btn[name='edit']",
run: "click",
},
{
content: "Annotate contains previous text value",
trigger:
".o-mail-Message:last-child .o-mail-Composer-inputContainer textarea:value(Annotation 121000)",
},
{
content: "Add text to annotate",
trigger: ".o-mail-Message:last-child .o-mail-Composer-inputContainer textarea",
run: "edit Annotation 121000 edited",
},
{
content: "Annotation is edited",
trigger:
".o-mail-Message:last-child .o-mail-Composer-inputContainer textarea:value(Annotation 121000 edited)",
},
{
content: "Save the annotation",
trigger: ".o-mail-Message:last-child .btn[data-type='save']",
run: "click",
},
{
content: "Close Chatter",
trigger: ".o_control_panel .btn-secondary[data-tooltip='Chatter']",
run: "click",
},
// Test that we dont show there is an annotation if we delete the only annotation of a line
{
content: "Open Third annotated line annotation popover",
trigger: "tr:nth-child(13) .btn_annotation",
run: "click",
},
{
content: "Wait for the messages to load",
trigger: ".o-mail-Message",
},
{
content: "Expand the options of the message",
trigger: ".o-mail-Message:last-child button:has(i.oi[data-icon='more_vert']):not(:visible)",
run: "click",
},
{
content: "Click on trash can",
trigger: ".o_popover .o-dropdown-item:has(i[data-icon='delete'])",
run: "click",
},
{
content: "Wait for the modal to appear",
trigger: ".modal",
},
{
content: "Confirm deletion of the annotation",
trigger: ".modal-footer .btn-danger",
run: "click",
},
{
content: "Close Chatter",
trigger: ".o_control_panel .btn-secondary[data-tooltip='Chatter']",
run: "click",
},
{
content: "Check there are now only two lines annotated",
trigger: "tr:nth-child(13):not(:has([data-icon='mode_comment'].oi-filled))",
},
{
trigger: `.btn_annotation.o_account_report_chatter_annotated:count(2)`,
},
],
});

View File

@@ -0,0 +1,79 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("account_reports_audit", {
steps: () => [
{
trigger: "button.o-kanban-button-new",
content: "Create a new Audit",
run: "click",
},
{
isActive: ["auto"],
trigger: ".modal",
content: "Wait for the modal to open",
},
{
trigger: "div[name='return_type_id'] .o_selection_badge:contains('Audit')",
content: "Select the Return Type",
run: "click",
},
{
trigger: ".modal-footer button.btn-primary",
content: "Generate the Audit",
run: "click",
},
{
trigger: "a[data-tooltip='Back to \"Working Files\"']",
content: "Back to the Audit Kanban",
run: "click",
},
{
trigger: ".o_account_return_audit_kanban_view .o_kanban_record:nth-child(1)",
content: "Open the working file",
run: "click",
},
{
trigger: ".o_embedded_actions button:contains('Balances')",
content: "Switch to the 'Balances' tab",
run: "click",
},
{
trigger: ".o_data_row .o_data_cell",
content: "Open the chatter for the first row",
run: "click",
},
{
content: "Add a log note",
trigger: ".o-mail-Chatter-logNote",
run: "click",
},
{
content: "Add text to annotate",
trigger: ".o-mail-Composer-inputContainer textarea",
run: "edit Annotation from the audit",
},
{
content: "Submit by logging the note",
trigger: ".o-mail-Composer-send",
run: "click",
},
{
content: "Annotation is posted",
trigger:
".o-mail-Message:last-child .o-mail-Message-textContent:text(Annotation from the audit)",
},
{
trigger:
".o_account_reports_annotation:contains(/^Annotated for [0-9]{2}/[0-9]{2}/[0-9]{4}$/)",
},
{
content: "Close Chatter",
trigger: ".o_control_panel .btn-secondary[data-tooltip='Chatter']",
run: "click",
},
{
content: "Check that the chatter is closed",
trigger: ".o_account_report_chatter:not(:visible)",
},
],
});

View File

@@ -0,0 +1,103 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add('account_reports_hide_0_lines', {
steps: () => [
{
content: 'test if the Bank and Cash line is present (but the value is 0)',
trigger: '.line_name:contains("Bank and Cash Accounts")',
run: "click",
},
{
content: 'test if the Current Year Unallocated Earnings line is present (but the value is 0)',
trigger: '.line_name:contains("Current Year Unallocated Earnings")',
run: "click",
},
{
content: 'test if the Earnings line is present (but value is different from 0 and so should be there after the hide_0_lines',
trigger: '.line_name:contains("Earnings")',
run: "click",
},
{
content: "Open options selector",
trigger: "#filter_extra_options button",
run: 'click',
},
{
content: "Select the hide line at 0 option",
trigger: ".dropdown-item:contains('Hide lines at 0')",
run: 'click',
},
{
content: 'test if the Earnings line is still present',
trigger: '.line_name:contains("Earnings")',
run: "click",
},
{
content: 'test if the Bank and Cash line is not present',
trigger: '.line_name:not(:contains("Bank and Cash Accounts"))',
run: "click",
},
{
content: 'test if the Current Year Unallocated Earnings line is not present',
trigger: '.line_name:not(:contains("Current Year Unallocated Earnings"))',
run: "click",
},
{
content: "Click again to open the options selector",
trigger: "#filter_extra_options button",
run: 'click',
},
{
content: "Select the hide lines at 0 option again",
trigger: ".dropdown-item:contains('Hide lines at 0')",
run: 'click',
},
{
content: 'test again if the Bank and Cash line is present (but the value is 0)',
trigger: '.line_name:contains("Bank and Cash Accounts")',
run: () => null,
},
]
});
registry.category("web_tour.tours").add('account_reports_hide_0_lines_with_string_columns', {
steps: () => [
{
content: "Check if the 211000 Accounts Payable line is present (but the value is 0)",
trigger: "td:contains('211000 Accounts Payable')",
run: "click",
},
{
content: "Check if the MISC item line is present with string values set up, but all amounts are at 0",
trigger: "td:contains('Coucou les biloutes')",
},
{
content: "Open options selector",
trigger: "#filter_extra_options button",
run: 'click',
},
{
content: "Select the hide line at 0 option",
trigger: ".dropdown-item:contains('Hide lines at 0')",
run: 'click',
},
{
content: "Check if the MISC item line is hidden",
trigger: ":not(:visible):contains('Coucou les biloutes')",
},
{
content: "Click again to open the options selector",
trigger: "#filter_extra_options button",
run: 'click',
},
{
content: "Select the hide lines at 0 option again",
trigger: ".dropdown-item:contains('Hide lines at 0')",
run: 'click',
},
{
content: "Check again if the MISC item line is present (but the value is 0)",
trigger: "td:contains('Coucou les biloutes')",
},
]
});

View File

@@ -0,0 +1,88 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("account_reports_load_more", {
steps: () => [
/*
When opening the report:
- 1 partner is shown
- 2 more in "load more"
- All lines are folded, first partner has 2 move lines to report, when unfolded (with a "1 more" after the first unfold)
*/
{
content: "Check default-loaded lines",
trigger: "tr:nth-child(2) td:nth-child(1)",
},
{
trigger: `tr:nth-child(3) td:nth-child(1):contains(partner_a)`,
},
{
content: "Unfold first partner",
trigger: "tr:nth-child(3) td:first().unfoldable",
run: "click",
},
{
content: "First partner should be unfolded",
trigger: "tr td:nth-child(1):contains('INV/2016/00001')",
},
{
trigger: `tr:nth-child(3) td:nth-child(1):contains(partner_a)`,
},
{
trigger: `tr:nth-child(4) td:nth-child(1):contains(INV/2016/00001)`,
},
{
trigger: `tr:nth-child(5) td:nth-child(1) a:text(1 more)`,
},
{
trigger: `tr:nth-child(6) td:nth-child(1):contains(Total partner_a)`,
},
{
trigger: `tr:nth-child(7) td:nth-child(1) a:text(2 more)`,
},
{
content: "Load more the first partner's move",
trigger: "a:text('1 more')",
run: "click",
},
{
trigger: `tr:nth-child(3) td:nth-child(1):contains(partner_a)`,
},
{
trigger: `tr:nth-child(4) td:nth-child(1):contains(INV/2016/00002)`,
},
{
trigger: `tr:nth-child(5) td:nth-child(1):contains(INV/2016/00001)`,
},
{
trigger: `tr:nth-child(6) td:nth-child(1):contains(Total partner_a)`,
},
{
trigger: `tr:nth-child(7) td:nth-child(1) a:text(2 more)`,
},
{
content: "Load more the other partners",
trigger: "a:text('2 more')",
run: "click",
},
{
content:
"All partners should be shown ; the expanded and loaded lines from partner 1 should still be there",
trigger: "tr td:nth-child(1):contains('partner_c')",
},
{
trigger: `tr:nth-child(3) td:nth-child(1):contains(partner_a)`,
},
{
trigger: `tr:nth-child(4) td:nth-child(1):contains(INV/2016/00002)`,
},
{
trigger: `tr:nth-child(5) td:nth-child(1):contains(INV/2016/00001)`,
},
{
trigger: `tr:nth-child(6) td:nth-child(1):contains(Total partner_a)`,
},
{
trigger: `tr:nth-child(7) td:nth-child(1):contains(partner_b)`,
},
],
});

View File

@@ -0,0 +1,40 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add('account_reports_search', {
steps: () => [
{
content: "click search",
trigger: '.o_searchview_input',
run: 'click',
},
{
content: 'insert text in the searchbar',
trigger: '.o_searchview_input',
run: "edit 40",
},
{
content: 'test if the product sale line is present',
trigger: '.line_name:contains("400000 Product Sales")',
run: "click",
},
{
content: "click search",
trigger: '.o_searchview_input',
run: 'click',
},
{
content: 'insert text in the search bar',
trigger: '.o_searchview_input',
run: "edit Account",
},
{
content: 'test if the receivable line is present',
trigger: '.line_name:contains("121000 Accounts Receivable")',
run: 'click',
},
{
content: 'check that the product sale line is not present',
trigger: '.line_name:not(:contains("400000 Product Sales"))',
},
]
});

View File

@@ -0,0 +1,141 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("account_reports_sections", {
steps: () => [
{
content: "Open variant selector",
trigger: "#filter_variant button",
run: "click",
},
{
content: "Select the test variant using sections",
trigger: ".dropdown-item:contains('Test Sections')",
run: "click",
},
{
content: "Check the lines of section 1 are displayed",
trigger: ".line_name:contains('Section 1 line')",
},
{
content: "Check the columns of section 1 are displayed",
trigger: "#table_header th:contains('Column 1')",
},
{
content: "Check the export buttons belong to the composite report",
trigger: ".btn:contains('composite_report_custom_button')",
},
{
content:
"Check the filters displayed belong to section 1 (journals filter is not enabled on section 2, nor the composite report)",
trigger: "#filter_journal",
},
{
content: "Open date switcher",
trigger: "#filter_date button",
run: "click",
},
{
content: "Select 'month' date filter",
trigger: ".dropdown-menu .dropdown-item[data-period-type='month']",
run: "click",
},
{
content: "Click on the current period to edit it manually",
trigger: ".dropdown-menu .dropdown-item[data-period-type='month'] .input_current_date",
run: "click",
},
{
content:
"Make sure December 2025 is opened, whatever the return type linked to the report",
trigger: ".dropdown-menu .dropdown-item[data-period-type='month'] .input_current_date",
run: "edit 12/2025",
},
{
content: "Click outside of the input to validate the choice",
trigger: ".dropdown-menu .dropdown-item[data-period-type='month']",
run: "click",
},
{
content: "Wait for the date to be refreshed",
trigger: `#filter_date button:contains('Dec 2025')`,
},
{
content: "Switch to section 2",
trigger: "#section_selector .btn:contains('Section 2')",
run: "click",
},
{
content: "Check the lines of section 2 are displayed",
trigger: ".line_name:contains('Section 2 line')",
},
{
content: "Check the columns of section 2 are displayed",
trigger: "#table_header th:contains('Column 2')",
},
{
content: "Check the export buttons belong to the composite report",
trigger: ".btn:contains('composite_report_custom_button')",
},
{
content:
"Check the filters displayed belong to section 2 (comparison filter is not enabled on section 1, nor the composite report)",
trigger: "#filter_comparison",
},
{
content: "Open date switcher",
trigger: "#filter_date button",
run: "click",
},
{
content: "Select another date in the future",
trigger: ".dropdown-menu .dropdown-item[data-period-type='year'] .btn_next_date",
run: "click",
},
{
content: "Apply filter by closing the dropdown for the future date",
trigger: "#filter_date .btn:first()",
run: "click",
},
{
content: "Check that the date has changed",
trigger: `#filter_date button:not(:contains(2025)):contains(2026)`,
},
{
content: "Open date switcher",
trigger: "#filter_date button",
run: "click",
},
{
content: "Select another date first time",
trigger: ".dropdown-menu .dropdown-item[data-period-type='year'] .btn_previous_date",
run: "click",
},
{
trigger: `.dropdown-menu .dropdown-item[data-period-type='year'] input[data-value*='2025']`,
},
{
content: "Select another date second time",
trigger: ".dropdown-menu .dropdown-item[data-period-type='year'] .btn_previous_date",
run: "click",
},
{
trigger: `.dropdown-menu .dropdown-item[data-period-type='year'] input[data-value*='2024']`,
},
{
content: "Apply filter by closing the dropdown",
trigger: "#filter_date .btn:first()",
run: "click",
},
{
content: "Check that the date has changed",
trigger: `#filter_date button:contains('2024')`,
},
{
content: "Switch back to section 1",
trigger: "#section_selector .btn:contains('Section 1')",
run: "click",
},
],
});

View File

@@ -0,0 +1,86 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("account_reports_widgets", {
steps: () => [
{
content: "change date filter",
trigger: "#filter_date button",
run: "click",
},
{
content: "Select another date in the future",
trigger: ".dropdown-menu .dropdown-item:nth-child(3) .btn_next_date",
run: "click",
},
{
content: "Apply filter by closing the dropdown",
trigger: "#filter_date .btn:first()",
run: "click",
},
{
content: "wait refresh",
trigger: `#filter_date button:not(:contains(${new Date().getFullYear()}))`,
},
{
content: "change date filter for the second time",
trigger: "#filter_date button",
run: "click",
},
{
content: "Select another date in the past first time",
trigger: ".dropdown-menu .dropdown-item:nth-child(3) .btn_previous_date",
run: "click",
},
{
trigger: `.dropdown-menu .dropdown-item:nth-child(3) input[data-value*='${new Date().getFullYear()}']`,
},
{
content: "Select another date in the past second time",
trigger: ".dropdown-menu .dropdown-item:nth-child(3) .btn_previous_date",
run: "click",
},
{
trigger: `.dropdown-menu .dropdown-item:nth-child(3) input[data-value*='${
new Date().getFullYear() - 1
}']`,
},
{
content: "Apply filter by closing the dropdown",
trigger: "#filter_date .btn:first()",
run: "click",
},
{
content: "wait refresh",
trigger: `#filter_date button:contains(${new Date().getFullYear() - 1})`,
},
{
content: "change comparison filter",
trigger: "#filter_comparison .btn:first()",
run: "click",
},
{
content: "select custom comparison dates",
trigger: "[name='filter_comparison_custom']",
run: "click",
},
{
content: "Apply filter by closing the dropdown",
trigger: "#filter_comparison .btn:first()",
run: "click",
},
{
content: "wait refresh, report should have comparison columns",
trigger: "th + th + th + th",
},
{
content: "Open actions dropdown",
trigger: ".o_control_panel_breadcrumbs_actions .dropdown-toggle",
run: "click",
},
{
content: "Export XLSX",
trigger: ".dropdown-item:contains('XLSX')",
run: "click",
},
],
});

View File

@@ -0,0 +1,66 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("account_return_flow_tax_return", {
steps: () => [
{
content: "Open Tax Returns",
trigger: "button[name='account_reports.action_server_open_view_account_return']",
run: "click",
},
{
content: "Check First Group Header",
trigger: ".o_account_return_padding:text(December 2023)",
},
{
content: "Open Return",
trigger: ".o_account-return-kanban .o_kanban_record span:contains('DUMMY_TAX')",
run: "click",
},
{
content: "Wait for Checks",
trigger: ".kanban_checks_view",
},
{
content: "Approve Company Data",
trigger: "div.o_field_account_review_state_selection_badge > button.btn-outline-danger",
run: "click",
},
{
content: "Select Valid Ckeck Status",
trigger: "div.o_popover > span:nth-child(3)",
run: "click",
},
{
content: "Validate Return",
trigger: "button[name='action_validate']",
run: "click",
},
{
content: "Verify State Advancement",
trigger: ".o_account_return_state > div.active:count(1)",
},
{
content: "Open Tax Return Report",
trigger: "button.btn-primary[name='action_open_report']",
run: "click",
},
{
content: "Wait for report to be shown",
trigger: ".account_report",
},
{
content: "Go back To Return",
trigger: ".o_breadcrumb .breadcrumb-item a",
run: "click",
},
{
content: "Submit Return",
trigger: "button[name='action_submit']",
run: "click",
},
{
content: "Verify State Advancement",
trigger: ".o_account_return_state > div.active:count(3)",
},
],
});

View File

@@ -0,0 +1,25 @@
import { patch } from "@web/core/utils/patch";
import { accountTourSteps } from "@account/js/tours/account";
patch(accountTourSteps, {
bankRecUiReportSteps() {
return [
{
trigger: ".o_bank_rec_selected_st_line:contains('line1')",
},
{
content: "balance is 2100",
trigger: ".btn-link:contains('$ 2,100.00')",
run: "click",
},
{
trigger: "span:contains('General Ledger')",
},
{
content: "Breadcrumb back to Bank Reconciliation from the report",
trigger: ".breadcrumb-item a:contains('Bank Reconciliation')",
run: "click",
},
];
},
});

View File

@@ -0,0 +1,48 @@
import { expect, test } from "@odoo/hoot";
import { buildLineId, parseLineId } from "@account_reports/js/util";
test("can build a line id from a list of [markup, res_model, res_id]", () => {
const values = [
[false, "account.account", 72],
[null, "account.move", "10"],
[undefined, "account.move.line", "22"],
["name", false, null],
['{"groupby": "account"}', false, null],
];
expect(buildLineId(values)).toBe(
'~account.account~72|~account.move~10|~account.move.line~22|name~~|{"groupby": "account"}~~'
);
});
test("can parse a line id from a generic id with a markup as object", () => {
const genericId =
'~account.account~72|~account.move~10|~account.move.line~22|name~~|{"groupby": "account"}~~';
expect(parseLineId(genericId)).toEqual([
[null, "account.account", 72],
[null, "account.move", 10],
[null, "account.move.line", 22],
["name", null, null],
[{ groupby: "account" }, null, null],
]);
});
test("can parse a line id from a generic id with a markup as string", () => {
const genericId =
'~account.account~72|~account.move~10|~account.move.line~22|name~~|{"groupby": "account"}~~';
expect(parseLineId(genericId, true)).toEqual([
[null, "account.account", 72],
[null, "account.move", 10],
[null, "account.move.line", 22],
["name", null, null],
['{"groupby": "account"}', null, null],
]);
});
test("can parse and rebuild a line id to have the same one", () => {
const genericId =
'~account.account~72|~account.move~10|~account.move.line~22|name~~|{"groupby": "account"}~~';
const parsedLineId = parseLineId(genericId);
const buildedGenericId = buildLineId(parsedLineId);
expect(buildedGenericId).toBe(genericId);
});