feat(regional): enable transaction log for germany (#19198)
This commit is contained in:
parent
a5776d16b4
commit
edba06038e
@ -235,17 +235,16 @@ doc_events = {
|
||||
("Sales Taxes and Charges Template", 'Price List'): {
|
||||
"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
|
||||
},
|
||||
|
||||
"Website Settings": {
|
||||
"validate": "erpnext.portal.doctype.products_settings.products_settings.home_page_is_products"
|
||||
},
|
||||
"Sales Invoice": {
|
||||
"on_submit": ["erpnext.regional.france.utils.create_transaction_log", "erpnext.regional.italy.utils.sales_invoice_on_submit"],
|
||||
"on_submit": ["erpnext.regional.create_transaction_log", "erpnext.regional.italy.utils.sales_invoice_on_submit"],
|
||||
"on_cancel": "erpnext.regional.italy.utils.sales_invoice_on_cancel",
|
||||
"on_trash": "erpnext.regional.check_deletion_permission"
|
||||
},
|
||||
"Payment Entry": {
|
||||
"on_submit": ["erpnext.regional.france.utils.create_transaction_log", "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"],
|
||||
"on_submit": ["erpnext.regional.create_transaction_log", "erpnext.accounts.doctype.payment_request.payment_request.make_status_as_paid"],
|
||||
"on_trash": "erpnext.regional.check_deletion_permission"
|
||||
},
|
||||
'Address': {
|
||||
|
@ -10,3 +10,21 @@ 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)
|
||||
|
@ -3,22 +3,6 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from erpnext import get_region
|
||||
|
||||
def create_transaction_log(doc, method):
|
||||
region = get_region()
|
||||
if region not in ["France"]:
|
||||
return
|
||||
else:
|
||||
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)
|
||||
|
||||
# don't remove this function it is used in tests
|
||||
def test_method():
|
||||
|
Loading…
x
Reference in New Issue
Block a user