Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1363 Visualizzazioni

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
ago 21
5129
0
apr 25
2019
1
ago 24
4155
1
ago 24
3290
1
dic 23
3350