diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index 24dd1887a6d..8c1c3f0a4e7 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -9,7 +9,6 @@ from frappe import msgprint, _ from frappe.model.document import Document class Attendance(Document): - def validate_duplicate_record(self): res = frappe.db.sql("""select name from `tabAttendance` where employee = %s and att_date = %s and name != %s and docstatus = 1""", diff --git a/erpnext/hr/doctype/branch/test_branch.py b/erpnext/hr/doctype/branch/test_branch.py index ec847413263..f1db481eb73 100644 --- a/erpnext/hr/doctype/branch/test_branch.py +++ b/erpnext/hr/doctype/branch/test_branch.py @@ -1,4 +1,4 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -test_records = [[{"doctype":"Branch", "branch":"_Test Branch"}]] \ No newline at end of file +test_records = [{"doctype":"Branch", "branch":"_Test Branch"}] \ No newline at end of file diff --git a/erpnext/hr/doctype/deduction_type/test_deduction_type.py b/erpnext/hr/doctype/deduction_type/test_deduction_type.py index ff3db8cbf4b..6f46d24a5d4 100644 --- a/erpnext/hr/doctype/deduction_type/test_deduction_type.py +++ b/erpnext/hr/doctype/deduction_type/test_deduction_type.py @@ -2,12 +2,12 @@ # License: GNU General Public License v3. See license.txt test_records = [ - [{ + { "doctype": "Deduction Type", "deduction_name": "_Test Professional Tax" - }], - [{ + }, + { "doctype": "Deduction Type", "deduction_name": "_Test TDS" - }] + } ] \ No newline at end of file diff --git a/erpnext/hr/doctype/department/test_department.py b/erpnext/hr/doctype/department/test_department.py index 6fa2dce9271..654c250737d 100644 --- a/erpnext/hr/doctype/department/test_department.py +++ b/erpnext/hr/doctype/department/test_department.py @@ -4,6 +4,6 @@ test_ignore = ["Leave Block List"] test_records = [ - [{"doctype":"Department", "department_name":"_Test Department"}], - [{"doctype":"Department", "department_name":"_Test Department 1"}] + {"doctype":"Department", "department_name":"_Test Department"}, + {"doctype":"Department", "department_name":"_Test Department 1"} ] diff --git a/erpnext/hr/doctype/designation/test_designation.py b/erpnext/hr/doctype/designation/test_designation.py index 8b28fa54b55..2ed331c7409 100644 --- a/erpnext/hr/doctype/designation/test_designation.py +++ b/erpnext/hr/doctype/designation/test_designation.py @@ -1,4 +1,4 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -test_records = [[{"doctype":"Designation", "designation_name":"_Test Designation"}]] \ No newline at end of file +test_records = [{"doctype":"Designation", "designation_name":"_Test Designation"}] \ No newline at end of file diff --git a/erpnext/hr/doctype/earning_type/test_earning_type.py b/erpnext/hr/doctype/earning_type/test_earning_type.py index 5d838a27e50..a7184a1663b 100644 --- a/erpnext/hr/doctype/earning_type/test_earning_type.py +++ b/erpnext/hr/doctype/earning_type/test_earning_type.py @@ -2,14 +2,14 @@ # License: GNU General Public License v3. See license.txt test_records = [ - [{ + { "doctype": "Earning Type", "earning_name": "_Test Basic Salary", "taxable": "Yes" - }], - [{ + }, + { "doctype": "Earning Type", "earning_name": "_Test Allowance", "taxable": "Yes" - }] + } ] \ No newline at end of file diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index 231e7b9c9ba..0291eb64cd6 100644 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -78,7 +78,7 @@ class Employee(DocListController): from frappe.utils.user import add_role add_role(self.user_id, "Employee") - user_wrapper = frappe.bean("User", self.user_id) + user_wrapper = frappe.get_doc("User", self.user_id) # copy details like Fullname, DOB and Image to User if self.employee_name: @@ -182,12 +182,12 @@ class Employee(DocListController): ends_on = self.date_of_birth + " 00:15:00" if birthday_event: - event = frappe.bean("Event", birthday_event[0][0]) + event = frappe.get_doc("Event", birthday_event[0][0]) event.starts_on = starts_on event.ends_on = ends_on event.save() else: - frappe.bean({ + frappe.get_doc({ "doctype": "Event", "subject": _("Birthday") + ": " + self.employee_name, "description": _("Happy Birthday!") + " " + self.employee_name, diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py index 1d3697be3d3..749f3420ded 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/expense_claim.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.model.bean import getlist -from frappe import msgprint +from frappe import _ from frappe.model.document import Document @@ -26,5 +26,4 @@ class ExpenseClaim(Document): def validate_exp_details(self): if not self.get('expense_voucher_details'): - msgprint("Please add expense voucher details") - raise Exception + frappe.throw(_("Please add expense voucher details")) diff --git a/erpnext/hr/doctype/grade/test_grade.py b/erpnext/hr/doctype/grade/test_grade.py index e3595e026c9..e0330e61693 100644 --- a/erpnext/hr/doctype/grade/test_grade.py +++ b/erpnext/hr/doctype/grade/test_grade.py @@ -1,4 +1,4 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -test_records = [[{"doctype":"Grade", "grade_name":"_Test Grade"}]] \ No newline at end of file +test_records = [{"doctype":"Grade", "grade_name":"_Test Grade"}] \ No newline at end of file diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py index 04d049bca38..26cc093acf7 100644 --- a/erpnext/hr/doctype/leave_application/test_leave_application.py +++ b/erpnext/hr/doctype/leave_application/test_leave_application.py @@ -31,8 +31,8 @@ class TestLeaveApplication(unittest.TestCase): employee.save() frappe.set_user(temp_session_user) - def get_application(self, doclist): - application = frappe.bean(copy=doclist) + def get_application(self, doc): + application = frappe.copy_doc(doc) application.from_date = "2013-01-01" application.to_date = "2013-01-05" return application