2
0
mirror of https://github.com/frappe/books.git synced 2024-12-31 14:01:51 +00:00

fix: dropdown create issue

- fix setup tests
This commit is contained in:
18alantom 2022-12-14 13:34:07 +05:30
parent cc1a3c26f5
commit 67235bfb3f
2 changed files with 24 additions and 7 deletions

View File

@ -137,14 +137,31 @@ export default {
},
async getCreateFilters() {
const { schemaName, fieldname } = this.df;
const getFilters = fyo.models[schemaName]?.createFilters?.[fieldname];
const filters = await getFilters?.(this.doc);
const getCreateFilters =
fyo.models[schemaName]?.createFilters?.[fieldname];
let createFilters = await getCreateFilters?.(this.doc);
if (filters === undefined) {
return await this.getFilters();
if (createFilters !== undefined) {
return createFilters;
}
return filters;
createFilters = {};
const filters = await this.getFilters();
for (const key of Object.keys(filters)) {
const value = filters[key];
if (value === undefined) {
continue;
}
if (Array.isArray(value)) {
continue;
}
createFilters[key] = value;
}
return createFilters;
},
async getFilters() {
const { schemaName, fieldname } = this.df;

View File

@ -17,8 +17,8 @@ export function getTestSetupWizardOptions(): SetupWizardOptions {
email: 'test@testmyfantasy.com',
bankName: 'Test Bank of Scriptia',
currency: 'INR',
fiscalYearStart: getFiscalYear('04-01', true)!.toISOString(),
fiscalYearEnd: getFiscalYear('04-01', false)!.toISOString(),
fiscalYearStart: getFiscalYear('04-01', true)!.toISOString().split('T')[0],
fiscalYearEnd: getFiscalYear('04-01', false)!.toISOString().split('T')[0],
chartOfAccounts: 'India - Chart of Accounts',
};
}