Fixed gl_entry Validation

This commit is contained in:
Neil Trini Lasrado 2015-07-28 12:23:14 +05:30
parent cc7cb2a70a
commit ff3b220c79

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, fmt_money, getdate, formatdate, cstr, cint
from frappe.utils import flt, fmt_money, getdate, formatdate, cstr
from frappe import _
from frappe.model.document import Document
@ -93,8 +93,9 @@ class GLEntry(Document):
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 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)