Merge pull request #1371 from Gadha2311/remove-filter

feat:  Added Remove Filter checkbox in System Settings
This commit is contained in:
Able k Saju
2025-11-05 11:33:51 +05:30
committed by GitHub
5 changed files with 43 additions and 11 deletions
+16 -9
View File
@@ -26,7 +26,8 @@ import { AccountTypeEnum } from '../Account/types';
import { Invoice } from '../Invoice/Invoice';
import { Party } from '../Party/Party';
import { PaymentFor } from '../PaymentFor/PaymentFor';
import { PaymentType } from './types';
import { PaymentType, PaymentTypeEnum } from './types';
import { PartyRoleEnum } from '../Party/types';
import { TaxSummary } from '../TaxSummary/TaxSummary';
import { PaymentMethod } from '../PaymentMethod/PaymentMethod';
@@ -662,17 +663,23 @@ export class Payment extends Transactional {
const partyDoc = (await this.loadAndGetLink('party')) as Party;
const outstanding = partyDoc.outstandingAmount as Money;
if (partyDoc.role === 'Supplier') {
if (partyDoc.role === PartyRoleEnum.Supplier) {
if (refDoc?.isReturn) {
return 'Receive';
return PaymentTypeEnum.Receive;
} else {
return 'Pay';
return PaymentTypeEnum.Pay;
}
} else if (partyDoc.role === 'Customer') {
} else if (partyDoc.role === PartyRoleEnum.Customer) {
if (refDoc?.isSales && refDoc.isReturn) {
return 'Pay';
return PaymentTypeEnum.Pay;
} else {
return 'Receive';
return PaymentTypeEnum.Receive;
}
} else if (partyDoc.role === PartyRoleEnum.Both) {
if (refDoc?.isSales && refDoc.isReturn) {
return PaymentTypeEnum.Pay;
} else {
return PaymentTypeEnum.Receive;
}
}
@@ -681,9 +688,9 @@ export class Payment extends Transactional {
}
if (outstanding?.isPositive()) {
return 'Receive';
return PaymentTypeEnum.Receive;
}
return 'Pay';
return PaymentTypeEnum.Pay;
},
},
amount: {
+8
View File
@@ -72,6 +72,14 @@
"description": "When linking documents, if no match is found and filtering is in effect, allow to disable filters.",
"section": "Default"
},
{
"fieldname": "removeFilter",
"label": "Remove Filter",
"fieldtype": "Check",
"default": false,
"description": "When enabled, removes all default filters applied across the system, showing all available options instead of filtered ones.",
"section": "Default"
},
{
"fieldname": "locale",
"label": "Locale",
+6 -1
View File
@@ -155,7 +155,7 @@ export default {
this.filtersDisabled = true;
this.results = [];
setTimeout(() => {
this.toggleDropdown(true);
this.isDropdownOpen = true;
this.updateSuggestions(keyword);
}, 1);
},
@@ -192,6 +192,11 @@ export default {
if (this.df.filters) {
return this.df.filters;
}
if (fyo.singles.SystemSettings?.removeFilter) {
return null;
}
const { schemaName, fieldname } = this.df;
const getFilters = fyo.models[schemaName]?.filters?.[fieldname];
+10
View File
@@ -22,6 +22,7 @@ interface StoredRecentItem {
route?: string;
schemaName?: string;
reportName?: string;
initData?: RawValueMap;
timestamp: number;
}
@@ -102,6 +103,7 @@ function getCreateList(fyo: Fyo): SearchItem[] {
label: fyo.schemaMap[schemaName]?.label,
group: 'Create',
action: getCreateAction(fyo, schemaName),
schemaName,
} as SearchItem)
);
@@ -151,6 +153,8 @@ function getCreateList(fyo: Fyo): SearchItem[] {
label,
group: 'Create',
action: getCreateAction(fyo, schemaName, create),
schemaName,
initData: create,
} as SearchItem;
});
@@ -430,6 +434,9 @@ export class Search {
recentItem.route = item.route;
} else if (item.group === 'Docs') {
recentItem.schemaName = item.schemaLabel;
} else if (item.group === 'Create') {
recentItem.schemaName = item.schemaName;
recentItem.initData = item.initData;
}
const updatedRecents = [
@@ -470,6 +477,9 @@ export class Search {
private _executeRecentAction(item: StoredRecentItem) {
if (item.route) {
void routeTo(item.route);
} else if (item.schemaName && item.group === 'Create') {
const action = getCreateAction(this.fyo, item.schemaName, item.initData);
void action();
} else if (item.schemaName) {
this._openDocList(item.schemaName);
} else if (item.reportName) {
+3 -1
View File
@@ -1,4 +1,4 @@
import type { ConfigFile } from 'fyo/core/types';
import type { ConfigFile, RawValueMap } from 'fyo/core/types';
export type UnknownMap = Record<string, unknown>;
export type Translation = { translation: string; context?: string };
@@ -96,4 +96,6 @@ export interface SearchItem {
group: Exclude<SearchGroup, 'Docs' | 'Recent'>;
route?: string;
action?: () => void | Promise<void>;
schemaName?: string;
initData?: RawValueMap;
}