2018-03-09 07:49:52 +00:00
|
|
|
# Copyright (c) 2018, Frappe Technologies and contributors
|
|
|
|
# For license information, please see license.txt
|
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2018-03-09 07:49:52 +00:00
|
|
|
import frappe
|
|
|
|
from frappe import _
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2018-03-09 07:49:52 +00:00
|
|
|
from erpnext import get_region
|
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2018-03-09 07:49:52 +00:00
|
|
|
def check_deletion_permission(doc, method):
|
2018-11-13 05:43:04 +00:00
|
|
|
region = get_region(doc.company)
|
2019-01-22 05:11:50 +00:00
|
|
|
if region in ["Nepal", "France"] and doc.docstatus != 0:
|
2020-01-29 09:36:18 +00:00
|
|
|
frappe.throw(_("Deletion is not permitted for country {0}").format(region))
|
2019-11-06 13:37:04 +00:00
|
|
|
|
|
|
|
def create_transaction_log(doc, method):
|
|
|
|
"""
|
|
|
|
Appends the transaction to a chain of hashed logs for legal resons.
|
|
|
|
Called on submit of Sales Invoice and Payment Entry.
|
|
|
|
"""
|
|
|
|
region = get_region()
|
|
|
|
if region not in ["France", "Germany"]:
|
|
|
|
return
|
|
|
|
|
|
|
|
data = str(doc.as_dict())
|
|
|
|
|
|
|
|
frappe.get_doc({
|
|
|
|
"doctype": "Transaction Log",
|
|
|
|
"reference_doctype": doc.doctype,
|
|
|
|
"document_name": doc.name,
|
|
|
|
"data": data
|
|
|
|
}).insert(ignore_permissions=True)
|
2021-09-06 18:36:55 +00:00
|
|
|
|