diff --git a/frappe/index.js b/frappe/index.js index 81560ad5..dae3e469 100644 --- a/frappe/index.js +++ b/frappe/index.js @@ -383,4 +383,5 @@ module.exports = { }, t, T, + store: {}, }; diff --git a/frappe/model/document.js b/frappe/model/document.js index 2fe9cde0..d9ca4b5a 100644 --- a/frappe/model/document.js +++ b/frappe/model/document.js @@ -3,6 +3,8 @@ const Observable = require('frappe/utils/observable'); const naming = require('./naming'); const { isPesa } = require('../utils/index'); const { DEFAULT_INTERNAL_PRECISION } = require('../utils/consts'); +const telemetry = require('@/telemetry/telemetry'); +const { Verb } = require('@/telemetry/types'); module.exports = class BaseDocument extends Observable { constructor(data) { @@ -577,6 +579,7 @@ module.exports = class BaseDocument extends Observable { await this.trigger('afterInsert'); await this.trigger('afterSave'); + telemetry.log(Verb.Created, this.doctype); return this; } @@ -620,6 +623,8 @@ module.exports = class BaseDocument extends Observable { await this.trigger('beforeDelete'); await frappe.db.delete(this.doctype, this.name); await this.trigger('afterDelete'); + + telemetry.log(Verb.Deleted, this.doctype); } async submitOrRevert(isSubmit) { diff --git a/src/main.js b/src/main.js index 125e1eff..90d5ea8a 100644 --- a/src/main.js +++ b/src/main.js @@ -25,7 +25,6 @@ import { setLanguageMap, showToast, stringifyCircular } from './utils'; ipcRenderer.invoke = getErrorHandled(ipcRenderer.invoke); window.frappe = frappe; - window.frappe.store = {}; window.onerror = (message, source, lineno, colno, error) => { error = error ?? new Error('triggered in window.onerror'); diff --git a/src/pages/PrintView/PrintView.vue b/src/pages/PrintView/PrintView.vue index 6a8b4072..eec4f7bb 100644 --- a/src/pages/PrintView/PrintView.vue +++ b/src/pages/PrintView/PrintView.vue @@ -51,15 +51,17 @@