feat(regional): enable transaction log for germany (#19198)
This commit is contained in:
committed by
Nabin Hait
parent
a5776d16b4
commit
edba06038e
@@ -235,17 +235,16 @@ doc_events = {
|
|||||||
("Sales Taxes and Charges Template", 'Price List'): {
|
("Sales Taxes and Charges Template", 'Price List'): {
|
||||||
"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
|
"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
|
||||||
},
|
},
|
||||||
|
|
||||||
"Website Settings": {
|
"Website Settings": {
|
||||||
"validate": "erpnext.portal.doctype.products_settings.products_settings.home_page_is_products"
|
"validate": "erpnext.portal.doctype.products_settings.products_settings.home_page_is_products"
|
||||||
},
|
},
|
||||||
"Sales Invoice": {
|
"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_cancel": "erpnext.regional.italy.utils.sales_invoice_on_cancel",
|
||||||
"on_trash": "erpnext.regional.check_deletion_permission"
|
"on_trash": "erpnext.regional.check_deletion_permission"
|
||||||
},
|
},
|
||||||
"Payment Entry": {
|
"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"
|
"on_trash": "erpnext.regional.check_deletion_permission"
|
||||||
},
|
},
|
||||||
'Address': {
|
'Address': {
|
||||||
|
|||||||
@@ -10,3 +10,21 @@ def check_deletion_permission(doc, method):
|
|||||||
region = get_region(doc.company)
|
region = get_region(doc.company)
|
||||||
if region in ["Nepal", "France"] and doc.docstatus != 0:
|
if region in ["Nepal", "France"] and doc.docstatus != 0:
|
||||||
frappe.throw(_("Deletion is not permitted for country {0}".format(region)))
|
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
|
from __future__ import unicode_literals
|
||||||
import frappe
|
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
|
# don't remove this function it is used in tests
|
||||||
def test_method():
|
def test_method():
|
||||||
|
|||||||
Reference in New Issue
Block a user