Skip to content

Commit da06b73

Browse files
authored
Version 15.4.3
2 parents 2b54dbc + a193dca commit da06b73

9 files changed

Lines changed: 65 additions & 8 deletions

File tree

erpnext_tse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "15.4.2"
1+
__version__ = "15.4.3"

erpnext_tse/erpnext_tse/doctype/dsfinv_k_cash_point_closing/dsfinv_k_cash_point_closing.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
from erpnext_tse.erpnext_tse.tss_providers import get_tse_provider
1414

1515

16+
def _is_tse_enabled() -> bool:
17+
return bool(frappe.db.get_single_value("TSE Settings", "enabled"))
18+
19+
1620
class DSFinVKCashPointClosing(Document):
1721
def log_provider_event(
1822
self,
@@ -50,6 +54,8 @@ def create_cash_point_closing_for_pos_closing_entry(doc, method: str | None = No
5054

5155
if doc.doctype != "POS Closing Entry":
5256
return
57+
if not _is_tse_enabled():
58+
return
5359

5460
if not getattr(doc, "pos_profile", None):
5561
frappe.throw(_("POS Closing Entry is missing a POS Profile."))
@@ -591,6 +597,9 @@ def enqueue_cash_point_closing_status_refresh(closing_name: str):
591597

592598

593599
def refresh_cash_point_closing_status(closing_name: str):
600+
if not _is_tse_enabled():
601+
return
602+
594603
closing_doc = frappe.get_doc("DSFinV-K Cash Point Closing", closing_name)
595604
if not closing_doc.closing_id:
596605
return
@@ -632,6 +641,9 @@ def refresh_cash_point_closing_status(closing_name: str):
632641

633642

634643
def refresh_pending_cash_point_closings():
644+
if not _is_tse_enabled():
645+
return
646+
635647
pending = frappe.get_all(
636648
"DSFinV-K Cash Point Closing",
637649
filters={

erpnext_tse/erpnext_tse/doctype/dsfinv_k_export/dsfinv_k_export.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
from erpnext_tse.erpnext_tse.tss_providers import get_tse_provider
1515

1616

17+
def _is_tse_enabled() -> bool:
18+
return bool(frappe.db.get_single_value("TSE Settings", "enabled"))
19+
20+
1721
class DSFinVKExport(Document):
1822
def log_provider_event(
1923
self,
@@ -46,6 +50,9 @@ def log_provider_event(
4650

4751
@frappe.whitelist()
4852
def trigger_export(name: str):
53+
if not _is_tse_enabled():
54+
frappe.throw(_("TSE integration is disabled. Please enable it in TSE Settings."))
55+
4956
doc = frappe.get_doc("DSFinV-K Export", name)
5057
if doc.export_id:
5158
frappe.throw(_("Export has already been triggered."))
@@ -98,6 +105,9 @@ def refresh_export_status(name: str):
98105

99106
@frappe.whitelist()
100107
def download_export(name: str):
108+
if not _is_tse_enabled():
109+
frappe.throw(_("TSE integration is disabled. Please enable it in TSE Settings."))
110+
101111
doc = frappe.get_doc("DSFinV-K Export", name)
102112
if not doc.export_id:
103113
frappe.throw(_("Export has not been triggered yet."))
@@ -192,6 +202,9 @@ def _apply_export_response(doc: Document, resp: dict[str, Any]):
192202

193203

194204
def _refresh_export_status_doc(doc: Document):
205+
if not _is_tse_enabled():
206+
return
207+
195208
if not doc.export_id:
196209
frappe.throw(_("Export has not been triggered yet."))
197210

@@ -240,6 +253,9 @@ def enqueue_export_status_refresh(export_name: str):
240253

241254

242255
def refresh_pending_exports():
256+
if not _is_tse_enabled():
257+
return
258+
243259
pending = frappe.get_all(
244260
"DSFinV-K Export",
245261
filters={
@@ -254,6 +270,9 @@ def refresh_pending_exports():
254270

255271

256272
def cleanup_expired_export_files():
273+
if not _is_tse_enabled():
274+
return
275+
257276
retention_days = frappe.db.get_single_value("TSE Settings", "dsfinvk_export_retention_days") or 0
258277
try:
259278
retention_days = int(retention_days)

erpnext_tse/erpnext_tse/doctype/tse_client/tse_client_list.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
const DOCTYPE = "TSE Client";
66
const SETTINGS_DOCTYPE = "TSE Settings";
77
const SETTINGS_FLAG_FIELD = "recovery_sync_enabled";
8+
const SETTINGS_ENABLED_FIELD = "enabled";
89

910
const RECOVERY_BTN_LABEL = __("Recovery Sync");
1011
const RECOVERY_SUCCESS_MSG = __("Recovery sync queued.");
@@ -23,8 +24,11 @@
2324

2425
async function getRecoveryEnabled() {
2526
try {
26-
const v = await frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_FLAG_FIELD);
27-
return toInt(v) === 1;
27+
const [recovery, enabled] = await Promise.all([
28+
frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_FLAG_FIELD),
29+
frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_ENABLED_FIELD),
30+
]);
31+
return toInt(recovery) === 1 && toInt(enabled) === 1;
2832
} catch (e) {
2933
return false;
3034
}

erpnext_tse/erpnext_tse/doctype/tse_security_device/tse_security_device_list.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
const DOCTYPE = "TSE Security Device";
66
const SETTINGS_DOCTYPE = "TSE Settings";
77
const SETTINGS_FLAG_FIELD = "recovery_sync_enabled";
8+
const SETTINGS_ENABLED_FIELD = "enabled";
89

910
const RECOVERY_BTN_LABEL = __("Recovery Sync");
1011
const RECOVERY_SUCCESS_MSG = __("Recovery sync queued.");
@@ -23,8 +24,11 @@
2324

2425
async function getRecoveryEnabled() {
2526
try {
26-
const v = await frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_FLAG_FIELD);
27-
return toInt(v) === 1;
27+
const [recovery, enabled] = await Promise.all([
28+
frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_FLAG_FIELD),
29+
frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_ENABLED_FIELD),
30+
]);
31+
return toInt(recovery) === 1 && toInt(enabled) === 1;
2832
} catch (e) {
2933
return false;
3034
}

erpnext_tse/erpnext_tse/doctype/tse_settings/tse_settings.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ function toggleDisableWarning(frm) {
99
frm.toggle_display("tse_disable_acknowledged", show_warning);
1010
}
1111

12+
function updateDisableWarningHtml(frm) {
13+
const message = __(
14+
"Warning: Disabling TSE interrupts the continuous signing of receipts. This can create gaps in the signature chain. Please confirm that you understand this."
15+
);
16+
frm.set_df_property(
17+
"tse_disable_warning_html",
18+
"options",
19+
`<div class="alert alert-warning">${message}</div>`
20+
);
21+
}
22+
1223
frappe.ui.form.on("TSE Settings", {
1324
// Runs every time the form is refreshed (opened, saved, etc.)
1425
refresh(frm) {
@@ -90,6 +101,7 @@ frappe.ui.form.on("TSE Settings", {
90101
if (frm._tse_was_enabled === undefined) {
91102
frm._tse_was_enabled = !!frm.doc.enabled;
92103
}
104+
updateDisableWarningHtml(frm);
93105
toggleDisableWarning(frm);
94106
},
95107

@@ -125,6 +137,7 @@ frappe.ui.form.on("TSE Settings", {
125137
indicator: "orange",
126138
});
127139
}
140+
updateDisableWarningHtml(frm);
128141
toggleDisableWarning(frm);
129142
// The button will appear / disappear after the user saves and the form reloads
130143
},

erpnext_tse/erpnext_tse/doctype/tse_settings/tse_settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
{
5353
"fieldname": "tse_disable_warning_html",
5454
"fieldtype": "HTML",
55-
"options": "<div class=\"alert alert-warning\">Warning: Disabling TSE interrupts the continuous signing of receipts. This can create gaps in the signature chain. Please confirm that you understand this.</div>"
55+
"options": ""
5656
},
5757
{
5858
"default": "0",

erpnext_tse/erpnext_tse/doctype/tse_transaction/tse_transaction_list.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
const DOCTYPE = "TSE Transaction";
66
const SETTINGS_DOCTYPE = "TSE Settings";
77
const SETTINGS_FLAG_FIELD = "recovery_sync_enabled";
8+
const SETTINGS_ENABLED_FIELD = "enabled";
89

910
const RECOVERY_BTN_LABEL = __("Recovery Sync");
1011
const RECOVERY_SUCCESS_MSG = __("Recovery sync queued.");
@@ -23,8 +24,11 @@
2324

2425
async function getRecoveryEnabled() {
2526
try {
26-
const v = await frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_FLAG_FIELD);
27-
return toInt(v) === 1;
27+
const [recovery, enabled] = await Promise.all([
28+
frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_FLAG_FIELD),
29+
frappe.db.get_single_value(SETTINGS_DOCTYPE, SETTINGS_ENABLED_FIELD),
30+
]);
31+
return toInt(recovery) === 1 && toInt(enabled) === 1;
2832
} catch (e) {
2933
return false;
3034
}

erpnext_tse/erpnext_tse/translations/de.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,4 @@ TSE Warning,TSE-Warnung,
160160
"Warning: Disabling TSE interrupts the continuous signing of receipts. Please confirm the warning before saving.","Warnung: Das Deaktivieren der TSE unterbricht die fortlaufende Signierung von Belegen. Bitte bestaetigen Sie den Hinweis vor dem Speichern.",
161161
"Disabling TSE interrupts the continuous signing of receipts. Please confirm the warning by checking ""I understand this warning"".","Das Deaktivieren der TSE unterbricht die fortlaufende Signierung von Belegen. Bitte bestaetigen Sie den Hinweis, indem Sie ""Ich habe den Hinweis verstanden"" ankreuzen.",
162162
ValidationError,Validierungsfehler,
163+
TSE integration is disabled. Please enable it in TSE Settings.,Die TSE-Integration ist deaktiviert. Bitte aktivieren Sie sie in den TSE Settings.,

0 commit comments

Comments
 (0)