Здесь ошибка:
OwlError: An error occured in the owl lifecycle (see this Error's "cause" property) Error: An error
occured in the owl lifecycle (see this Error's "cause" property) at handleError
(http://localhost:8069/web/assets/debug/ ... js:9193:35) (/web/static/lib/owl/owl.js:1633) at
App.handleError (http://localhost:8069/web/assets/debug/ ... s:13590:20)
(/web/static/lib/owl/owl.js:6030) at Fiber._render
(http://localhost:8069/web/assets/debug/ ... js:9346:30) (/web/static/lib/owl/owl.js:1786) at
Fiber.render (http://localhost:8069/web/assets/debug/ ... js:9335:18)
(/web/static/lib/owl/owl.js:1775) at ComponentNode.initiateRender
(http://localhost:8069/web/assets/debug/ ... s:10015:23) (/web/static/lib/owl/owl.js:2455)
Caused by: TypeError: Cannot read properties of undefined (reading 'name') at TimeOffDashboard.template
(eval at compile (http://localhost:8069/web/assets/debug/ ... s:13312:20), :30:47)
(/web/static/lib/owl/owl.js:5752) at Fiber._render
(http://localhost:8069/web/assets/debug/ ... js:9343:38) (/web/static/lib/owl/owl.js:1783) at
Fiber.render (http://localhost:8069/web/assets/debug/ ... js:9335:18)
(/web/static/lib/owl/owl.js:1775) at ComponentNode.initiateRender
(http://localhost:8069/web/assets/debug/ ... s:10015:23) (/web/static/lib/owl/owl.js:2455)
JS
< /code>
/** @odoo-module **/
import { Component, onWillStart, useState, xml } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
import { registry } from "@web/core/registry";
export class CustomDashboardTimeOffCard extends Component {
setup() {
this.orm = useService("orm");
this.user = useService("user");
this.state = useState({
employeeId: null,
allocationsData: [],
});
onWillStart(async () => {
const employee = await this.orm.call(
"hr.employee",
"search_read",
[[["user_id", "=", this.user.userId]]],
{ limit: 1, fields: ["id"] }
);
if (employee.length > 0) {
this.state.employeeId = employee[0].id;
const allocations = await this.orm.call(
"hr.leave.type",
"get_detailed_allocations_data_request",
[this.state.employeeId]
);
this.state.allocationsData = allocations;
}
});
}
}
CustomDashboardTimeOffCard.template = "hr_personal_time_automator.CustomDashboardTimeOffCard";
registry.category("components").add("hr_personal_time_automator.CustomDashboardTimeOffCard", {
Component: CustomDashboardTimeOffCard,
});
< /code>
Шаблон xml < /p>
ASIG
:
(VALIDO HASTA: )
Cargando datos...
< /code>
xml наследственный TimeOffDashboard < /p>
manifest el Orden de Assets
"depends": ["base", "web", "hr_holidays", "hr", "mail"],
"data": [],
"assets": {
"web.assets_backend": [
"hr_personal_time_automator/static/src/xml/custom_dashboard_time_off_card.xml",
"hr_personal_time_automator/static/src/js/custom_dashboard_time_off_card.js",
"hr_personal_time_automator/static/src/xml/time_off_dashboard_extend.xml",
"hr_personal_time_automator/static/src/css/hide_allocation_button.css"
],
},
Подробнее здесь: https://stackoverflow.com/questions/797 ... pt-in-odoo
Мобильная версия