mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-03 00:23:21 +00:00
* chore: Added isort to pre-commit config * chore: Sort imports with isort * chore: Remove imports with pycln * chore: Sort imports with isort * chore: Fix import issues * chore: Fix sider issues * chore: linting * chore: linting / sorting import from ecommerce refactor merge * ci: dont allow unused imports * chore: sort / clean ecommerce imports Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
34 lines
877 B
Python
34 lines
877 B
Python
# Copyright (c) 2018, Frappe Technologies and contributors
|
|
# For license information, please see license.txt
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
import frappe
|
|
from frappe import _
|
|
|
|
from erpnext import get_region
|
|
|
|
|
|
def check_deletion_permission(doc, method):
|
|
region = get_region(doc.company)
|
|
if region in ["Nepal", "France"] and doc.docstatus != 0:
|
|
frappe.throw(_("Deletion is not permitted for country {0}").format(region))
|
|
|
|
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)
|