Allowed frozen_accounts_modifier to create records against frozen customer/supplier
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index d3246d7..83955ec 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -93,7 +93,8 @@
frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
def validate_party(self):
- if self.party_type and self.party:
+ frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
+ if self.party_type and self.party and not frozen_accounts_modifier in frappe.get_roles():
if frappe.db.get_value(self.party_type, self.party, "is_frozen"):
frappe.throw("{0} {1} is frozen".format(self.party_type, self.party), CustomerFrozen)
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index cbd8a6f..55e9e3d 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -346,6 +346,10 @@
return self._abbr
def validate_party(self):
+ frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
+ if frozen_accounts_modifier in frappe.get_roles():
+ return
+
party_type = None
if self.meta.get_field("customer"):
party_type = 'Customer'
diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py
index 2f9c4e1..dca4bb7 100644
--- a/erpnext/selling/doctype/customer/test_customer.py
+++ b/erpnext/selling/doctype/customer/test_customer.py
@@ -68,17 +68,13 @@
frappe.rename_doc("Customer", "_Test Customer 1 Renamed", "_Test Customer 1")
def test_freezed_customer(self):
- cust = frappe.get_doc("Customer", "_Test Customer")
- cust.is_frozen = 1
- cust.save()
+ frappe.db.set_value("Customer", "_Test Customer", "is_frozen", 1)
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
so = make_sales_order(do_not_save= True)
- so.customer = "_Test Customer"
self.assertRaises(CustomerFrozen, so.save)
- cust.is_frozen = 0
- cust.save()
+ frappe.db.set_value("Customer", "_Test Customer", "is_frozen", 0)
so.save()
\ No newline at end of file