Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the option to turn off item account filtering #778

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions models/baseModels/Item/Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,28 @@
};

static filters: FiltersMap = {
incomeAccount: () => ({
isGroup: false,
rootType: AccountRootTypeEnum.Income,
}),
expenseAccount: (doc) => ({
isGroup: false,
rootType: doc.trackItem
? AccountRootTypeEnum.Liability
: AccountRootTypeEnum.Expense,
}),
incomeAccount: (doc) => {

Check failure on line 61 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_test

Type '(doc: Doc) => { isGroup: false; rootType: AccountRootTypeEnum; } | { isGroup: false; rootType?: undefined; }' is not assignable to type 'FilterFunction'.
if (doc.fyo.singles.AccountingSettings?.itemAccountFiltering) {
return {
isGroup: false,
rootType: AccountRootTypeEnum.Income

Check warning on line 65 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Insert `,`
}

Check warning on line 66 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Insert `;`
} else {
return {isGroup: false}

Check warning on line 68 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Replace `isGroup:·false}` with `·isGroup:·false·};`
}
},
expenseAccount: (doc) => {

Check failure on line 71 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_test

Type '(doc: Doc) => { isGroup: false; rootType: AccountRootTypeEnum; } | { isGroup: false; rootType?: undefined; }' is not assignable to type 'FilterFunction'.
if (doc.fyo.singles.AccountingSettings?.itemAccountFiltering) {
return {
isGroup: false,
rootType: doc.trackItem
? AccountRootTypeEnum.Liability
: AccountRootTypeEnum.Expense

Check warning on line 77 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Insert `,`
}

Check warning on line 78 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Insert `;`
} else {
return {isGroup: false}

Check warning on line 80 in models/baseModels/Item/Item.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Replace `isGroup:·false}` with `·isGroup:·false·};`
}
},
};

validations: ValidationMap = {
Expand Down
7 changes: 7 additions & 0 deletions schemas/app/AccountingSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@
"default": false,
"section": "Features"
},
{
"fieldname": "itemAccountFiltering",
"label": "Filter out non expense accounts for items",
"fieldtype": "Check",
"default": true,
"section": "Features"
},
{
"fieldname": "fiscalYearStart",
"label": "Fiscal Year Start Date",
Expand Down
Loading