コンテンツへスキップ
メニュー
この質問にフラグが付けられました

Hello,

I'm trying to extend AccountReport and new date selection in options. I'm able to display this filtr also pass the data to model. But when I try to registr JS functions for handle and parse date I will fail that ctx.getChangeDateFilter() is not exist. Manifest loads both files. I'm able to see result in the Options menu. And also I'm able to find function getChangeDateFilter in minified JS.

filter.js

/** @odoo-module */

import {AccountReport} from "@account_reports/components/account_report/account_report";
import {AccountReportFilters} from "@account_reports/components/account_report/filters/filters";

const {DateTime} = luxon;

export class SysteeReportFilters extends AccountReportFilters {

static template = "l10n_cz_reports_systee.ChangedAfterDateReportFilterExtraOptions";

get getChangeDateFilter() {
if (!this.controller.options["changed_after_date"]) {
            return null;
        }
        return DateTime.fromISO(this.controller.options["changed_after_date"]);
}

setChangeDateFilter(date) {
        this.controller.options["changed_after_date"] = date;
}
}

console.log("SysteeReportFilters", SysteeReportFilters);
AccountReport.registerCustomComponent(SysteeReportFilters);

filter_extra_options.xml

<?xml version="1.0" encoding="utf-8" ?>
<templates>
    <t t-name="l10n_cz_reports_systee.ChangedAfterDateReportFilterExtraOptions" t-inherit="account_reports.AccountReportFilterExtraOptions" t-inherit-mode="extension">
        <xpath expr="//Dropdown" position="inside">
            <t t-if="controller.options['changed_after_date'] or controller.options['changed_after_date'] === false">
                <separator/>
                <div class="dropdown-item date">
                    <label class="d-flex align-items-center">
                        Changed after date
                    </label>
                    <div>
                        <DateTimeInput
                                type="'date'"
                                value="getChangeDateFilter()"
                                onChange="(dateChangeFrom) => controller.options.changed_after_date.date_from = dateChangeFrom"
                                placeholder="'YYYY-MM-DD'"
                        />
                        <button
                                class="btn btn-sm btn-primary"
                                t-on-click="() => this.updateFilter('use_date_change_filter', true)"
                        >
                            Apply
                        </button>
                    </div>
                </div>
            </t>
        </xpath>
    </t>
</templates>

Thank you for any Ideas.

アバター
破棄
関連投稿 返信 ビュー 活動
1
8月 21
4547
0
4月 25
1359
1
8月 24
3362
1
8月 24
2606
1
12月 23
2634