Merge pull request #1383 from Gadha2311/party-ledger

feat : Party ledger
This commit is contained in:
Able k Saju
2025-11-05 14:38:09 +05:30
committed by GitHub
2 changed files with 41 additions and 3 deletions
+15 -3
View File
@@ -125,10 +125,22 @@ export default defineComponent({
docsPathMap[this.reportClassName] ?? docsPathMap.Reports!;
await this.setReportData();
const filters = JSON.parse(this.defaultFilters) as Record<string, DocValue>;
const filterKeys = Object.keys(filters);
const filters = this.$route.query as Record<string, DocValue>;
const validFilters: Record<string, DocValue> = {};
if (filters.defaultFilters && typeof filters.defaultFilters === 'string') {
const parsed = JSON.parse(filters.defaultFilters);
Object.assign(validFilters, parsed);
}
for (const [key, value] of Object.entries(filters)) {
if (key !== 'defaultFilters' && typeof value === 'string') {
validFilters[key] = value;
}
}
const filterKeys = Object.keys(validFilters);
for (const key of filterKeys) {
await this.report?.set(key, filters[key]);
await this.report?.set(key, validFilters[key]);
}
if (filterKeys.length) {
+26
View File
@@ -197,6 +197,11 @@ export function getActionsForDoc(doc?: Doc): Action[] {
getCancelAction(doc),
];
if (doc?.schemaName === 'Party') {
const viewActions = getViewActions(doc);
actions.push(...viewActions);
}
return actions
.filter((d) => d.condition?.(doc) ?? true)
.map((d) => {
@@ -235,6 +240,27 @@ export function getGroupedActionsForDoc(doc?: Doc): ActionGroup[] {
return [grouped, actionsMap['']].flat().filter(Boolean);
}
function getViewActions(doc: Doc): Action[] {
const actions: Action[] = [
{
label: t`General Ledger`,
group: t`View`,
condition: (doc: Doc) => doc.schemaName === 'Party',
action: async () => {
await router.push({
path: '/report/GeneralLedger',
query: {
defaultFilters: JSON.stringify({
party: doc.name,
}),
},
});
},
},
];
return actions;
}
function getCancelAction(doc: Doc): Action {
return {
label: t`Cancel`,