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 from __future__ import unicode_literals
import frappe 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 import _
from frappe.model.document import Document from frappe.model.document import Document
@ -93,10 +93,11 @@ class GLEntry(Document):
frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company)) frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
def validate_party(self): def validate_party(self):
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier') if self.party_type and self.party:
if self.party_type and self.party and not frozen_accounts_modifier in frappe.get_roles(): frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
if frappe.db.get_value(self.party_type, self.party, "is_frozen"): if not frozen_accounts_modifier in frappe.get_roles():
frappe.throw("{0} {1} is frozen".format(self.party_type, self.party), CustomerFrozen) 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)
def validate_balance_type(account, adv_adj=False): def validate_balance_type(account, adv_adj=False):
if not adv_adj and account: if not adv_adj and account: