Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

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.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Agu 21
4544
0
Apr 25
1357
1
Agu 24
3341
1
Agu 24
2598
1
Des 23
2628