2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +00:00

fix: show Ledger Entries

This commit is contained in:
18alantom 2022-05-27 12:45:07 +05:30 committed by Alan
parent 9bb5299b97
commit cda198bc69
3 changed files with 25 additions and 5 deletions

View File

@ -64,12 +64,11 @@ export function getLedgerLinkAction(fyo: Fyo): Action {
router.push({
name: 'Report',
params: {
reportName: 'general-ledger',
defaultFilters: {
// @ts-ignore
reportClassName: 'GeneralLedger',
defaultFilters: JSON.stringify({
referenceType: doc.schemaName,
referenceName: doc.name,
},
}),
},
});
},

View File

@ -57,7 +57,7 @@ export abstract class Report extends Observable<RawValue> {
return filterMap;
}
async set(key: string, value: RawValue) {
async set(key: string, value: RawValue, callPostSet: boolean = true) {
const field = this.filters.find((f) => f.fieldname === key);
if (field === undefined) {
return;
@ -74,6 +74,12 @@ export abstract class Report extends Observable<RawValue> {
this[key] = value;
}
if (callPostSet) {
await this.postSet(key);
}
}
async postSet(key?: string) {
await this.setDefaultFilters();
this.filters = await this.getFilters();
this.columns = await this.getColumns();

View File

@ -47,6 +47,10 @@ import { defineComponent } from 'vue';
export default defineComponent({
props: {
reportClassName: String,
defaultFilters: {
type: String,
default: '{}',
},
},
data() {
return {
@ -62,6 +66,17 @@ export default defineComponent({
components: { PageHeader, FormControl, ListReport, DropdownWithActions },
async activated() {
await this.setReportData();
const filters = JSON.parse(this.defaultFilters);
const filterKeys = Object.keys(filters);
for (const key of filterKeys) {
await this.report.set(key, filters[key]);
}
if (filterKeys.length) {
await this.report.postSet()
}
if (fyo.store.isDevelopment) {
window.rep = this;
}