mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-24 18:52:02 +02:00
Initial commit: Hr packages
This commit is contained in:
commit
62531cd146
2820 changed files with 1432848 additions and 0 deletions
|
|
@ -0,0 +1,84 @@
|
|||
/** @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"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
odoo.define('hr_expense.tests.tours', function (require) {
|
||||
"use strict";
|
||||
|
||||
var tour = require('web_tour.tour');
|
||||
|
||||
tour.register('hr_expense_test_tour', {
|
||||
test: true,
|
||||
url: "/web",
|
||||
}, [tour.stepUtils.showAppsMenuItem(),
|
||||
{
|
||||
content: "Go to Expense",
|
||||
trigger: '.o_app[data-menu-xmlid="hr_expense.menu_hr_expense_root"]',
|
||||
},
|
||||
{
|
||||
content: "Check Upload Button",
|
||||
trigger: '.o_button_upload_expense',
|
||||
run() {
|
||||
const button = document.querySelector('.o_button_upload_expense');
|
||||
if(!button) {
|
||||
console.error('Missing Upload button in My Expenses to Report > 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: "Go to kanban view",
|
||||
trigger: "button.o_switch_view.o_kanban",
|
||||
},
|
||||
{
|
||||
content: "Check Upload Button",
|
||||
trigger: "button.o_switch_view.o_kanban.active",
|
||||
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');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
content: "Go to Reporting",
|
||||
trigger: 'button[data-menu-xmlid="hr_expense.menu_hr_expense_reports"]',
|
||||
},
|
||||
{
|
||||
content: "Go to Expenses Analysis",
|
||||
trigger: 'a[data-menu-xmlid="hr_expense.menu_hr_expense_all_expenses"]',
|
||||
},
|
||||
{
|
||||
content: "Go to list view",
|
||||
trigger: "button.o_switch_view.o_list",
|
||||
},
|
||||
{
|
||||
content: "Check Upload Button",
|
||||
trigger: "button.o_switch_view.o_list.active",
|
||||
run() {
|
||||
const button = document.querySelector('.o_button_upload_expense');
|
||||
if(!button) {
|
||||
console.error('Missing Upload button in Expenses Analysis > List View');
|
||||
}
|
||||
}
|
||||
},
|
||||
]);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue