mirror of
https://github.com/frappe/books.git
synced 2024-11-08 23:00:56 +00:00
incr: save version in the db
This commit is contained in:
parent
58dce76d10
commit
6dfad44ba3
@ -88,7 +88,19 @@
|
||||
"label": "Currency",
|
||||
"fieldtype": "AutoComplete",
|
||||
"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 setCreds(fyo);
|
||||
await setVersion(fyo);
|
||||
await setCurrencySymbols(fyo);
|
||||
}
|
||||
|
||||
@ -48,6 +49,21 @@ async function setCreds(fyo: Fyo) {
|
||||
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) {
|
||||
const currencies = (await fyo.db.getAll(ModelNameEnum.Currency, {
|
||||
fields: ['name', 'symbol'],
|
||||
|
Loading…
Reference in New Issue
Block a user