コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

Caused by: TypeError: this is null in Odoo 18 Owl js which creating a scheduler dashboard

この質問にフラグが付けられました
質問は終了しました 理由: Question / Code not indented
次により: Rakesh Patel (patr) on 2024/11/07 01:47:15
Cybrosys
2537 ビュー
アバター
Mohammed Farhan k c
/** @odoo-module **/

import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { useService } from '@web/core/utils/hooks';
import { Component, onWillStart, useState } from "@odoo/owl";

const monthNames = [
"", "January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
];

export class TrainingDashboard extends Component {
static template = "TrainingDashboardMain";
setup(){
super.setup();
this.state = useState({
month: 1,
monthName: monthNames[1],
instructor: null,
instructorName: "Not Selected",
instructorsData: [],
year: null,
yearsData: [],
schedulesData: [],
noOfDaysData: [],
totalHoursData: 0,
loading: true,
});
this.action = useService("action");

onWillStart(async () => {
await this.loadDatas();
});
}

// -------------- On Clicking Buttons ---------------

onClickAddSchedule = () => {
this.action.doAction({
name: _t("My Planning"),
type: 'ir.actions.act_window',
res_model: 'training.slot',
view_mode: 'tree,form,calendar',
views: [[false, 'form']],
target: 'new',
});
}

onClickPrintSchedule = () => {
this.action.doAction({
name: _t("Print Schedule"),
type: 'ir.actions.act_window',
res_model: 'customer.schedule.report',
view_mode: 'tree,form',
views: [[false, 'form']],
target: 'new',
});
}

onClickPrint = () => {
this.action.doAction({
name: _t("Month Schedule"),
type: 'ir.actions.act_window',
res_model: 'schedule.board.print',
view_mode: 'form',
views: [[false, 'form']],
target: 'new',
});
}

onClickSearch = async () => {
this.state.loading = true;
const month = this.state.month;
const year = this.state.year;
const instructor = this.state.instructor;
const response = await fetch(`/api/get_custom_training_dashboard_datas?month=${month}&year=${year}&instructor=${instructor}`);
const data = await response.json();
console.log("data", data);
if (response.ok) {
this.state.noOfDaysData = data.response.no_of_days;
this.state.schedulesData = data.response.schedules;
this.state.totalHoursData = data.response.total_hours;
}
this.state.loading = false;
}


// ------------- Load Datas From API -------------------

async loadDatas() {
this.state.loading = true;
const response = await fetch('/api/get_training_dashboard_datas');
const data = await response.json();
console.log("data", data);
if (response.ok) {
this.state.yearsData = data.response.years;
this.state.year = Math.max(...data.response.years);
this.state.instructorsData = data.response.instructors;
this.state.instructor = data.response.instructors ? data.response.instructors[0].id : null;
this.state.noOfDaysData = data.response.no_of_days;
this.state.schedulesData = data.response.schedules;
this.state.totalHoursData = data.response.total_hours;
// Set initial values for monthName and instructorName based on data
this.updateMonthName();
this.updateInstructorName();
}
this.state.year = 2024;
this.state.month = 11;
this.state.instructor = 23;
this.state.loading = false;
}

// --------- Updaters Function ------------

// Update the displayed month name based on the current month value
updateMonthName() {
this.state.monthName = monthNames[this.state.month];
}

// Update displayed instructor name or default to "Not Selected"
updateInstructorName() {
const instructorId = Number(this.state.instructor);
const instructor = this.state.instructorsData.find(inst => inst.id === instructorId);
this.state.instructorName = instructor ? instructor.name : "Not Selected";
}

}

registry.category("actions").add("training_dashboard", TrainingDashboard);


<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="TrainingDashboardMain">
<style>
table, th, td {
border: 1px solid black;
}
th, td {
text-align: center;
max-width: 50px;
word-wrap: break-word;
}
thead th {
background-color: #ABDD93;
position: sticky;
top: 0;
z-index: 1;
}
.dashboard-container {
padding: 15px;
position: relative;
}
.filter-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
}
/* Loader styling */
.loading-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: rgba(255, 255, 255, 0.7);
z-index: 1000;
}
.spinner-border {
width: 3rem;
height: 3rem;
}
@media (max-width: 576px) {
.dashboard-buttons, .filter-container {
justify-content: center;
}
.filter-container .col {
width: 100%;
text-align: center;
}
}
</style>

<div class="dashboard-container">
<!-- Loader overlay -->
<t t-if="state.loading">
<div class="loading-overlay">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</t>
<!-- Dashboard Content -->
<div class="row">
<!-- Left side buttons -->
<div class="col-md-6 col-12 row gap-3 border-end">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center">
<h5>Instructor: <span class="fw-bolder" t-esc="state.instructorName || 'Not Selected'"/></h5>
<h5>Month: <span class="fw-bolder" t-esc="state.monthName"/></h5>
<h5>Year: <span class="fw-bolder" t-esc="state.year"/></h5>
</div>
<h5>Total Hours: <span class="fw-bolder" t-esc="state.totalHoursData"/></h5>
</div>
<div class="col-12 d-flex justify-content-start align-items-end">
<button class="btn btn-warning btn-sm rounded-pill me-2 fw-bolder text-white "
type="button" t-on-click="() => onClickAddSchedule()">Add Schedule</button>
<button class="btn btn-success btn-sm rounded-pill me-2 fw-bolder"
type="button" t-on-click="() => onClickPrintSchedule()">Print Schedule</button>
<button class="btn btn-primary btn-sm rounded-pill fw-bolder" type="button"
t-on-click="() => onClickPrint()">Print</button>
</div>
</div>

<!-- Right side filters and search button -->
<div class="col-md-6 col-12 filter-container d-flex justify-content-center align-items-center">
<div class="col-auto">
<label for="inst" class="form-label">Instructor</label>
<select t-model="state.instructor" class="form-select form-select-sm"
t-on-change="updateInstructorName">
<t t-foreach="state.instructorsData" t-as="instructor" t-key="instructor.id">
<option t-att-value="instructor.id"><t t-esc="instructor.name"/></option>
</t>
</select>
</div>
<div class="col-auto">
<label for="month" class="form-label">Month</label>
<select t-model="state.month" class="form-select form-select-sm" t-on-change="updateMonthName">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</div>
<div class="col-auto">
<label for="year" class="form-label">Year</label>
<select t-model="state.year" class="form-select form-select-sm">
<t t-foreach="state.yearsData" t-as="year" t-key="year">
<option t-att-value="year"><t t-esc="year"/></option>
</t>
</select>
</div>
<div class="col-auto">
<button class="btn btn-primary btn-sm rounded mt-md-4" type="button"
t-on-click="() => onClickSearch()">Search</button>
</div>
</div>
</div>
<hr class="my-2"/>
<!-- datas -->
<div class="row">
<div class="col-sm-12 col-lg-12 leave-manager">
<div style="overflow-y:auto; height: 500px;border: 1px solid black;border-radius: 7px;width:100%;">
<table style="border: 1px solid black;border-radius: 7px;width:100%;height:100%">
<thead>
<tr>
<th class="fw-bolder">Time/Date</th>
<t t-foreach="state.noOfDaysData" t-as="day" t-key="day">
<th class="fw-bolder"><t t-esc="day"/></th>
</t>
</tr>
</thead>
<tbody>
<t t-foreach="state.schedulesData" t-as="schedule" t-key="schedule">
<tr>
<t t-foreach="schedule" t-as="data" t-key="data">
<t t-if="data.code=='N'">
<td><t t-esc="data.value"/></td>
</t>
<t t-elif="data.code=='F'">
<td bgcolor="#F0F042"><t t-esc="data.value"/></td>
</t>
<t t-elif="data.code=='L'">
<td bgcolor="#ED8A49"><t t-esc="data.value"/></td>
</t>
<t t-elif="data.code=='P'">
<td style="color:#DB6262"><t t-esc="data.value"/></td>
</t>
<t t-elif="data.code=='R'">
<td><t t-esc="data.value"/></td>
</t>
<t t-elif="data.code=='FP'">
<td style="color:#DB6262;background-color: #F0F042;"><t t-esc="data.value"/></td>
</t>
<t t-elif="data.code=='FR'">
<td style="color:#0A0000;background-color: #F0F042;"><t t-esc="data.value"/></td>
</t>
</t>
</tr>
</t>
</tbody>
</table>
</div>
</div>
</div>
</div>
</t>

<t t-name="EmployeeWarning">
<div>
<p>Error : Could not find employee linked to user</p>
<p>Please contact system admin for the setup</p>
</div>
</t>

</templates>

アバター
破棄
ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
Odoo 16 add custom button next to create button in tree view 解決済
Cybrosys
アバター
アバター
アバター
2
10月 24
4894
odoo report downloading in doc/docx file
Cybrosys
アバター
アバター
1
5月 24
2408
Odoo 16 Migrations Error 解決済
Cybrosys
アバター
アバター
1
10月 23
2976
How to hide a menu from admin but not from normal user, is it possible or not ?
Cybrosys
アバター
アバター
1
12月 22
3343
Api.autovacuum Not working
Cybrosys
アバター
0
10月 22
2110
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now