2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 23:00:56 +00:00

refactor: rename linkFields to actions, remove clear filter from viewConfigs

This commit is contained in:
18alantom 2021-12-21 11:37:36 +05:30 committed by Alan
parent 9869daf498
commit c4c5ef3a9f
8 changed files with 38 additions and 94 deletions

View File

@ -43,7 +43,7 @@ export default {
fieldname: 'toDate',
},
],
linkFields: [
actions: [
{
label: 'Reconcile',
type: 'secondary',
@ -62,14 +62,6 @@ export default {
});
},
},
{
label: 'Clear Filters',
type: 'secondary',
action: async (report) => {
await report.getReportData({});
report.usedToReRender += 1;
},
},
],
getColumns() {
return [

View File

@ -67,21 +67,7 @@ const viewConfig = {
},
],
method: 'general-ledger',
linkFields: [
{
label: 'Clear Filters',
type: 'secondary',
action: async report => {
await report.getReportData({});
report.usedToReRender += 1;
}
},
{
label: 'Export',
type: 'primary',
action: () => {}
}
],
actions: [],
getColumns() {
return [
{

View File

@ -1,5 +1,5 @@
import { generateGstr1Json } from '../../accounting/gst';
import { DateTime } from 'luxon';
import { generateGstr1Json } from '../../accounting/gst';
export default {
filterFields: [
@ -41,22 +41,15 @@ export default {
default: () => DateTime.local().toISODate(),
},
],
linkFields: [
actions: [
{
label: 'Export as JSON',
type: 'secondary',
group: 'Export',
label: 'JSON',
type: 'primary',
action: async (report, filters) => {
generateGstr1Json(report, filters);
},
},
{
label: 'Clear Filters',
type: 'secondary',
action: async report => {
await report.getReportData({});
report.usedToReRender += 1;
}
}
],
getColumns() {

View File

@ -5,6 +5,6 @@ export default {
title: title,
method: 'gstr-1',
filterFields: baseConfig.filterFields,
linkFields: baseConfig.linkFields,
actions: baseConfig.actions,
getColumns: baseConfig.getColumns,
};

View File

@ -5,6 +5,6 @@ export default {
title: title,
method: 'gstr-2',
filterFields: baseConfig.filterFields,
linkFields: baseConfig.linkFields,
actions: baseConfig.actions,
getColumns: baseConfig.getColumns,
};

View File

@ -11,17 +11,17 @@ export default {
fieldname: 'supplier',
size: 'small',
placeholder: 'Supplier Name',
getFilters: query => {
getFilters: (query) => {
if (query)
return {
keywords: ['like', query],
supplier: 1
supplier: 1,
};
return {
supplier: 1
supplier: 1,
};
}
},
},
{
fieldtype: 'Date',
@ -29,7 +29,7 @@ export default {
size: 'small',
placeholder: 'From Date',
label: 'From Date',
required: 1
required: 1,
},
{
fieldtype: 'Date',
@ -37,19 +37,10 @@ export default {
placeholder: 'To Date',
fieldname: 'toDate',
label: 'To Date',
required: 1
}
],
linkFields: [
{
label: 'Clear Filters',
type: 'secondary',
action: async report => {
await report.getReportData({});
report.usedToReRender += 1;
}
}
required: 1,
},
],
actions: [],
getColumns() {
return [
{ label: 'PurchaseInvoice', fieldname: 'name' },
@ -58,7 +49,7 @@ export default {
{ label: 'Payable Account', fieldname: 'account' },
{ label: 'Net Total', fieldname: 'netTotal', fieldtype: 'Currency' },
{ label: 'Total Tax', fieldname: 'totalTax', fieldtype: 'Currency' },
{ label: 'Grand Total', fieldname: 'grandTotal', fieldtype: 'Currency' }
{ label: 'Grand Total', fieldname: 'grandTotal', fieldtype: 'Currency' },
];
}
},
};

View File

@ -11,17 +11,17 @@ export default {
size: 'small',
placeholder: 'Customer Name',
fieldname: 'customer',
getFilters: query => {
getFilters: (query) => {
if (query)
return {
keywords: ['like', query],
customer: 1
customer: 1,
};
return {
customer: 1
customer: 1,
};
}
},
},
{
fieldtype: 'Date',
@ -29,7 +29,7 @@ export default {
size: 'small',
placeholder: 'From Date',
label: 'From Date',
required: 1
required: 1,
},
{
fieldtype: 'Date',
@ -37,19 +37,10 @@ export default {
placeholder: 'To Date',
fieldname: 'toDate',
label: 'To Date',
required: 1
}
],
linkFields: [
{
label: 'Clear Filters',
type: 'secondary',
action: async report => {
await report.getReportData({});
report.usedToReRender += 1;
}
}
required: 1,
},
],
actions: [],
getColumns() {
return [
{ label: 'SalesInvoice', fieldname: 'name' },
@ -58,7 +49,7 @@ export default {
{ label: 'Receivable Account', fieldname: 'account' },
{ label: 'Net Total', fieldname: 'netTotal', fieldtype: 'Currency' },
{ label: 'Total Tax', fieldname: 'totalTax', fieldtype: 'Currency' },
{ label: 'Grand Total', fieldname: 'grandTotal', fieldtype: 'Currency' }
{ label: 'Grand Total', fieldname: 'grandTotal', fieldtype: 'Currency' },
];
}
},
};

View File

@ -16,7 +16,7 @@ export default {
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearStart;
}
},
},
{
fieldtype: 'Date',
@ -27,46 +27,37 @@ export default {
required: 1,
default: async () => {
return (await frappe.getSingle('AccountingSettings')).fiscalYearEnd;
}
}
],
linkFields: [
{
label: 'Clear Filters',
type: 'secondary',
action: async report => {
await report.getReportData({});
report.usedToReRender += 1;
}
},
},
],
actions: [],
getColumns(data) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
{
label: 'Opening (Dr)',
fieldtype: 'Currency',
fieldname: 'openingDebit'
fieldname: 'openingDebit',
},
{
label: 'Opening (Cr)',
fieldtype: 'Currency',
fieldname: 'openingCredit'
fieldname: 'openingCredit',
},
{ label: 'Debit', fieldtype: 'Currency', fieldname: 'debit' },
{ label: 'Credit', fieldtype: 'Currency', fieldname: 'credit' },
{
label: 'Closing (Dr)',
fieldtype: 'Currency',
fieldname: 'closingDebit'
fieldname: 'closingDebit',
},
{
label: 'Closing (Cr)',
fieldtype: 'Currency',
fieldname: 'closingCredit'
}
fieldname: 'closingCredit',
},
];
return columns;
}
},
};