تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
846 أدوات العرض

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
أغسطس 21
4546
0
أبريل 25
1358
1
أغسطس 24
3344
1
أغسطس 24
2600
1
ديسمبر 23
2629