diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index f73d16a1678..822717b3723 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -20,7 +20,7 @@ from webnotes import _, msgprint from webnotes.utils import flt, cint, today, cstr from setup.utils import get_company_currency, get_price_list_currency from accounts.utils import get_fiscal_year, validate_fiscal_year -from utilities.transaction_base import TransactionBase, validate_conversion_rate, validate_uom_is_integer +from utilities.transaction_base import TransactionBase, validate_conversion_rate import json class AccountsController(TransactionBase): @@ -55,15 +55,15 @@ class AccountsController(TransactionBase): label=self.meta.get_label(date_field)) def validate_for_freezed_account(self): - for fld in ["customer", "supplier"]: - if self.meta.get_field(fld): - accounts = webnotes.conn.get_values("Account", {"master_type": fld.upper(), - "master_name": self.doc.fields[fld], "company": self.doc.company}, + for fieldname in ["customer", "supplier"]: + if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname): + accounts = webnotes.conn.get_values("Account", {"master_type": fieldname.title(), + "master_name": self.doc.fields[fieldname], "company": self.doc.company}, "freeze_account", as_dict=1) if accounts: if not filter(lambda x: cstr(x.freeze_account) in ["", "No"], accounts): - msgprint(_("Account for this ") + fld + _(" has been freezed. ") + + msgprint(_("Account for this ") + fieldname + _(" has been freezed. ") + self.doc.doctype + _(" can not be made."), raise_exception=1) def set_price_list_currency(self, buying_or_selling): diff --git a/hr/doctype/grade/grade.txt b/hr/doctype/grade/grade.txt index 0050ed928d2..fdfa5c737c5 100644 --- a/hr/doctype/grade/grade.txt +++ b/hr/doctype/grade/grade.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:14", "docstatus": 0, - "modified": "2013-07-22 15:27:26", + "modified": "2013-07-26 15:24:31", "modified_by": "Administrator", "owner": "Administrator" }, @@ -16,11 +16,17 @@ }, { "doctype": "DocField", + "fieldname": "grade_name", + "fieldtype": "Data", + "label": "Grade", "name": "__common__", + "oldfieldname": "grade_name", + "oldfieldtype": "Data", "parent": "Grade", "parentfield": "fields", "parenttype": "DocType", - "permlevel": 0 + "permlevel": 0, + "reqd": 1 }, { "cancel": 1, @@ -42,22 +48,7 @@ "name": "Grade" }, { - "doctype": "DocField", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "oldfieldtype": "Small Text", - "read_only": 1 - }, - { - "doctype": "DocField", - "fieldname": "grade_name", - "fieldtype": "Data", - "label": "Grade", - "oldfieldname": "grade_name", - "oldfieldtype": "Data", - "reqd": 1 + "doctype": "DocField" }, { "doctype": "DocPerm"