19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:00 +01:00
parent a1137a1456
commit e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions

View file

@ -1,84 +0,0 @@
/** @odoo-module **/
import { registerCleanup } from "@web/../tests/helpers/cleanup";
import { getFixture, nextTick } from "@web/../tests/helpers/utils";
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
import { registry } from "@web/core/registry";
import { makeFakeHTTPService } from "@web/../tests/helpers/mock_services";
const serviceRegistry = registry.category("services");
let target;
let serverData;
QUnit.module("Expense", (hooks) => {
hooks.beforeEach(() => {
serviceRegistry.add("http", makeFakeHTTPService());
target = getFixture();
serverData = {
models: {
partner: {
fields: {
display_name: { string: "Displayed name", type: "char" },
},
},
},
};
});
QUnit.test("expense dashboard can horizontally scroll", async function (assert) {
// for this test, we need the elements to be visible in the viewport
target = document.body;
target.classList.add("debug");
registerCleanup(() => target.classList.remove("debug"));
serverData.views = {
"partner,false,search": `<search/>`,
"partner,false,list": `
<tree js_class="hr_expense_dashboard_tree">
<field name="display_name"/>
</tree>
`,
};
const webclient = await createWebClient({
serverData,
target,
async mockRPC(_, { method }) {
if (method === "get_expense_dashboard") {
return {
draft: {
description: "to report",
amount: 1000000000.00,
currency: 2,
},
reported: {
description: "under validation",
amount: 1000000000.00,
currency: 2,
},
approved: {
description: "to be reimbursed",
amount: 1000000000.00,
currency: 2,
},
};
}
},
});
await doAction(webclient, {
res_model: "partner",
type: "ir.actions.act_window",
views: [[false, "list"]],
});
const statusBar = target.querySelector(".o_expense_container");
statusBar.scrollLeft = 20;
await nextTick();
assert.strictEqual(
statusBar.scrollLeft,
20,
"the o_content should be 20 due to the overflow auto"
);
});
});

View file

@ -0,0 +1,124 @@
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
registry.category("web_tour.tours").add('create_expense_no_employee_access_tour', {
url: "/odoo",
steps: () => [
...stepUtils.goToAppSteps('hr_expense.menu_hr_expense_root', "Go to the Expenses app"),
{
content: "Remove filter for own expenses",
trigger: '.o_facet_value:contains(My Expenses) + button[title="Remove"]',
run: 'click',
},
{
content: "Go to form view of pre-prepared record",
trigger: '.o_data_cell:contains(expense_for_tour_0)',
run: 'click',
},
{
content: "Click employee selection dropdown",
trigger: 'input#employee_id_0',
run: 'click',
},
{
content: "Delete default search",
trigger: 'input#employee_id_0',
run: "clear",
},
{
content: "Select test expense employee",
trigger: 'a.dropdown-item:contains(expense_employee)',
run: 'click',
},
{
content: "Save",
trigger: ".o_form_button_save:enabled",
run: 'click',
},
{
content: "wait until the form is saved",
trigger: "body .o_form_saved",
},
{
content: "Exit form",
trigger: '.o_menu_brand',
run: 'click',
},
stepUtils.showAppsMenuItem(),
{
content: "Check",
trigger: '.o_app[data-menu-xmlid="hr_expense.menu_hr_expense_root"]',
},
]});
registry.category("web_tour.tours").add("do_not_create_zero_amount_expense", {
url: "/odoo",
steps: () => [
...stepUtils.goToAppSteps("hr_expense.menu_hr_expense_root", "Go to the Expenses app"),
{
content: "Remove filter for own expenses",
trigger: '.o_facet_value:contains(My Expenses) + button[title="Remove"]',
run: 'click',
},
{
content: "Go to an expense",
trigger: '.o_data_row .o_data_cell[data-tooltip="expense_for_tour"]',
run: "click",
},
{
content: "Select category to Expense",
trigger: "div[name=product_id] input",
run: "click",
},
{
content: "Choose category to Expense",
trigger:
".o_field_widget[name=product_id] .o-autocomplete--dropdown-menu li:contains(EXP_GEN)",
run: "click",
},
{
content: "Set total amount to zero",
trigger: "div[name=total_amount_currency] input",
run: "edit 0.0",
},
{
content: "Click Submit",
trigger: ".o_expense_submit",
run: "click",
},
{
content: "Close the displayed user error indicating that the expense total cannot be set to zero if non-draft.",
trigger: ".modal .modal-footer .btn-primary.o-default-button",
run: "click",
},
{
content: "Set total amount to ten",
trigger: "div[name=total_amount_currency] input",
run: "edit 10.0",
},
{
content: "Click Submit",
trigger: ".o_expense_submit",
run: "click",
},
// Valid expense was saved on submit
{
content: "Set total amount to zero",
trigger: "div[name=total_amount_currency] input",
run: "edit 0.0",
},
// Save should fail
{
content: "Click Approve",
trigger: ".o_expense_approve",
run: "click",
},
{
content: "Close the displayed user error indicating that the expense total cannot be set to zero if non-draft.",
trigger: ".modal .modal-footer .btn-primary.o-default-button",
run: "click",
},
// Return to the valid expense
...stepUtils.discardForm(),
],
});

View file

@ -1,15 +1,18 @@
odoo.define('hr_expense.tests.tours', function (require) {
"use strict";
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
var tour = require('web_tour.tour');
tour.register('hr_expense_test_tour', {
test: true,
url: "/web",
}, [tour.stepUtils.showAppsMenuItem(),
registry.category("web_tour.tours").add('hr_expense_test_tour', {
url: "/odoo",
steps: () => [stepUtils.showAppsMenuItem(),
{
content: "Go to Expense",
trigger: '.o_app[data-menu-xmlid="hr_expense.menu_hr_expense_root"]',
run: "click",
},
{
content: "Go to My Expenses",
trigger: 'button[data-menu-xmlid="hr_expense.menu_hr_expense_my_expenses"]',
run: "click",
},
{
content: "Check Upload Button",
@ -17,24 +20,39 @@ odoo.define('hr_expense.tests.tours', function (require) {
run() {
const button = document.querySelector('.o_button_upload_expense');
if(!button) {
console.error('Missing Upload button in My Expenses to Report > List View');
console.error('Missing Upload button in My Expenses > List View');
}
}
},
{
content: "Check Create Report Button, but not click on it",
trigger: "button.o_switch_view.o_list.active",
run() {
const button = Array.from(document.querySelectorAll('.btn-secondary'))
.filter(element => element.textContent.includes('Create Report'));
if(!button) {
console.error('Missing Create Report button in My Expenses to Report > List View');
}
}
content: "Create a new expense",
trigger: "button.o_list_button_add",
run: "click",
},
{
content: "Enter category for new expense in Many2One field",
trigger: ".o_field_widget.o_field_many2one[name=product_id] input",
run: "edit [COMM] Communication",
},
{
isActive: ["auto"],
trigger: ".ui-autocomplete > li > a:contains('[COMM] Communication')",
run: "click",
},
{
content: "Enter a value for the total",
trigger: "div[name=total_amount_currency] input",
run: "edit 100",
},
{
content: "Breadcrumb back to My Expenses",
trigger: ".breadcrumb-item:contains('My Expenses')",
run: "click",
},
{
content: "Go to kanban view",
trigger: "button.o_switch_view.o_kanban",
run: "click",
},
{
content: "Check Upload Button",
@ -42,32 +60,24 @@ odoo.define('hr_expense.tests.tours', function (require) {
run() {
const button = document.querySelector('.o_button_upload_expense');
if(!button) {
console.error('Missing Upload button in My Expenses to Report > Kanban View');
}
}
},
{
content: "Check Create Report Button, but not click on it",
trigger: "button.o_switch_view.o_kanban.active",
run() {
const button = Array.from(document.querySelectorAll('.btn-secondary'))
.filter(element => element.textContent.includes('Create Report'));
if(!button) {
console.error('Missing Create Report button in My Expenses to Report > Kanban View');
console.error('Missing Upload button in My Expenses > Kanban View');
}
}
},
{
content: "Go to Reporting",
trigger: 'button[data-menu-xmlid="hr_expense.menu_hr_expense_reports"]',
run: "click",
},
{
content: "Go to Expenses Analysis",
trigger: 'a[data-menu-xmlid="hr_expense.menu_hr_expense_all_expenses"]',
run: "click",
},
{
content: "Go to list view",
trigger: "button.o_switch_view.o_list",
run: "click",
},
{
content: "Check Upload Button",
@ -79,5 +89,33 @@ odoo.define('hr_expense.tests.tours', function (require) {
}
}
},
]);
});
]});
registry.category("web_tour.tours").add('hr_expense_access_rights_test_tour', {
url: "/odoo",
steps: () => [stepUtils.showAppsMenuItem(),
{
content: "Go to Expense",
trigger: '.o_app[data-menu-xmlid="hr_expense.menu_hr_expense_root"]',
run: "click",
},
{
content: "Go to My Expenses",
trigger: 'button[data-menu-xmlid="hr_expense.menu_hr_expense_my_expenses"]',
run: "click",
},
{
content: "Go to First Expense for employee",
trigger: 'td[data-tooltip="First Expense for employee"]',
run: "click",
},
{
content: "Click Submit to Manager Button",
trigger: '.o_expense_submit',
run: "click",
},
{
content: 'Verify the expense is submitted',
trigger: '.o_arrow_button_current:contains("Submitted")',
},
]});