2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

fix: company name update in db selector on change

This commit is contained in:
18alantom 2021-12-09 13:14:06 +05:30
parent 6fdabcb68c
commit 2d7cf505e5

View File

@ -76,14 +76,19 @@ export async function connectToLocalDatabase(filePath) {
await postStart();
// set file info in config
const { companyName } = frappe.AccountingSettings;
let files = config.get('files') || [];
if (!files.find((file) => file.filePath === filePath)) {
if (
!files.find(
(file) => file.filePath === filePath && file.companyName === companyName
)
) {
files = [
{
companyName: frappe.AccountingSettings.companyName,
filePath: filePath,
companyName,
filePath,
},
...files,
...files.filter((file) => file.filePath !== filePath),
];
config.set('files', files);
}