mirror of
https://github.com/frappe/books.git
synced 2025-01-05 08:02:15 +00:00
incr: save version in the db
This commit is contained in:
parent
58dce76d10
commit
6dfad44ba3
@ -88,7 +88,19 @@
|
|||||||
"label": "Currency",
|
"label": "Currency",
|
||||||
"fieldtype": "AutoComplete",
|
"fieldtype": "AutoComplete",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "version",
|
||||||
|
"label": "Version",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"readOnly": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quickEditFields": ["locale", "dateFormat", "currency", "displayPrecision", "hideGetStarted"]
|
"quickEditFields": [
|
||||||
|
"locale",
|
||||||
|
"dateFormat",
|
||||||
|
"currency",
|
||||||
|
"displayPrecision",
|
||||||
|
"hideGetStarted"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ export async function initializeInstance(
|
|||||||
|
|
||||||
await setSingles(fyo);
|
await setSingles(fyo);
|
||||||
await setCreds(fyo);
|
await setCreds(fyo);
|
||||||
|
await setVersion(fyo);
|
||||||
await setCurrencySymbols(fyo);
|
await setCurrencySymbols(fyo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +49,21 @@ async function setCreds(fyo: Fyo) {
|
|||||||
fyo.auth.user = email ?? user;
|
fyo.auth.user = email ?? user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setVersion(fyo: Fyo) {
|
||||||
|
const version = (await fyo.getValue(
|
||||||
|
ModelNameEnum.SystemSettings,
|
||||||
|
'version'
|
||||||
|
)) as string | undefined;
|
||||||
|
|
||||||
|
const { appVersion } = fyo.store;
|
||||||
|
if (version !== appVersion) {
|
||||||
|
const systemSettings = await fyo.doc.getSingle(
|
||||||
|
ModelNameEnum.SystemSettings
|
||||||
|
);
|
||||||
|
await systemSettings?.setAndSync('version', appVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function setCurrencySymbols(fyo: Fyo) {
|
async function setCurrencySymbols(fyo: Fyo) {
|
||||||
const currencies = (await fyo.db.getAll(ModelNameEnum.Currency, {
|
const currencies = (await fyo.db.getAll(ModelNameEnum.Currency, {
|
||||||
fields: ['name', 'symbol'],
|
fields: ['name', 'symbol'],
|
||||||
|
Loading…
Reference in New Issue
Block a user