mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 07:37:04 +00:00
This commit is contained in:
@@ -101,7 +101,7 @@ class Employee(DocListController):
|
||||
if not user_wrapper.user_image == self.image:
|
||||
user_wrapper.user_image = self.image
|
||||
try:
|
||||
frappe.doc({
|
||||
frappe.get_doc({
|
||||
"doctype": "File Data",
|
||||
"file_name": self.image,
|
||||
"attached_to_doctype": "User",
|
||||
|
||||
@@ -9,7 +9,7 @@ from frappe.core.doctype.communication.communication import _make
|
||||
|
||||
class JobsMailbox(POP3Mailbox):
|
||||
def setup(self, args=None):
|
||||
self.settings = args or frappe.doc("Jobs Email Settings", "Jobs Email Settings")
|
||||
self.settings = args or frappe.get_doc("Jobs Email Settings", "Jobs Email Settings")
|
||||
|
||||
def process_message(self, mail):
|
||||
if mail.from_email == self.settings.email_id:
|
||||
@@ -18,7 +18,7 @@ class JobsMailbox(POP3Mailbox):
|
||||
name = frappe.db.get_value("Job Applicant", {"email_id": mail.from_email},
|
||||
"name")
|
||||
if name:
|
||||
applicant = frappe.bean("Job Applicant", name)
|
||||
applicant = frappe.get_doc("Job Applicant", name)
|
||||
if applicant.status!="Rejected":
|
||||
applicant.status = "Open"
|
||||
applicant.ignore_permissions = True
|
||||
@@ -26,7 +26,7 @@ class JobsMailbox(POP3Mailbox):
|
||||
else:
|
||||
name = (mail.from_real_name and (mail.from_real_name + " - ") or "") \
|
||||
+ mail.from_email
|
||||
applicant = frappe.bean({
|
||||
applicant = frappe.get_doc({
|
||||
"creation": mail.date,
|
||||
"doctype":"Job Applicant",
|
||||
"applicant_name": name,
|
||||
|
||||
@@ -18,7 +18,7 @@ from frappe.model.controller import DocListController
|
||||
class LeaveApplication(DocListController):
|
||||
def setup(self):
|
||||
if frappe.db.exists(self.doctype, self.name):
|
||||
self.previous_doc = frappe.doc(self.doctype, self.name)
|
||||
self.previous_doc = frappe.get_doc(self.doctype, self.name)
|
||||
else:
|
||||
self.previous_doc = None
|
||||
|
||||
@@ -147,7 +147,7 @@ class LeaveApplication(DocListController):
|
||||
(self.leave_type, max_days))
|
||||
|
||||
def validate_leave_approver(self):
|
||||
employee = frappe.bean("Employee", self.employee)
|
||||
employee = frappe.get_doc("Employee", self.employee)
|
||||
leave_approvers = [l.leave_approver for l in
|
||||
employee.get("employee_leave_approvers")]
|
||||
|
||||
@@ -166,7 +166,7 @@ class LeaveApplication(DocListController):
|
||||
raise_exception=LeaveApproverIdentityError)
|
||||
|
||||
def notify_employee(self, status):
|
||||
employee = frappe.doc("Employee", self.employee)
|
||||
employee = frappe.get_doc("Employee", self.employee)
|
||||
if not employee.user_id:
|
||||
return
|
||||
|
||||
@@ -186,7 +186,7 @@ class LeaveApplication(DocListController):
|
||||
})
|
||||
|
||||
def notify_leave_approver(self):
|
||||
employee = frappe.doc("Employee", self.employee)
|
||||
employee = frappe.get_doc("Employee", self.employee)
|
||||
|
||||
def _get_message(url=False):
|
||||
name = self.name
|
||||
|
||||
@@ -23,7 +23,7 @@ class TestLeaveApplication(unittest.TestCase):
|
||||
def _add_employee_leave_approver(self, employee, leave_approver):
|
||||
temp_session_user = frappe.session.user
|
||||
frappe.set_user("Administrator")
|
||||
employee = frappe.bean("Employee", employee)
|
||||
employee = frappe.get_doc("Employee", employee)
|
||||
employee.append("employee_leave_approvers", {
|
||||
"doctype": "Employee Leave Approver",
|
||||
"leave_approver": leave_approver
|
||||
|
||||
@@ -86,7 +86,7 @@ class SalaryManager(Document):
|
||||
if not frappe.db.sql("""select name from `tabSalary Slip`
|
||||
where docstatus!= 2 and employee = %s and month = %s and fiscal_year = %s and company = %s
|
||||
""", (emp[0], self.month, self.fiscal_year, self.company)):
|
||||
ss = frappe.bean({
|
||||
ss = frappe.get_doc({
|
||||
"doctype": "Salary Slip",
|
||||
"fiscal_year": self.fiscal_year,
|
||||
"employee": emp[0],
|
||||
|
||||
@@ -9,7 +9,7 @@ class TestSalarySlip(unittest.TestCase):
|
||||
frappe.db.sql("""delete from `tabLeave Application`""")
|
||||
frappe.db.sql("""delete from `tabSalary Slip`""")
|
||||
from erpnext.hr.doctype.leave_application.test_leave_application import test_records as leave_applications
|
||||
la = frappe.bean(copy=leave_applications[4])
|
||||
la = frappe.get_doc(copy=leave_applications[4])
|
||||
la.insert()
|
||||
la.status = "Approved"
|
||||
la.submit()
|
||||
@@ -19,7 +19,7 @@ class TestSalarySlip(unittest.TestCase):
|
||||
|
||||
def test_salary_slip_with_holidays_included(self):
|
||||
frappe.db.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 1)
|
||||
ss = frappe.bean(copy=test_records[0])
|
||||
ss = frappe.get_doc(copy=test_records[0])
|
||||
ss.insert()
|
||||
self.assertEquals(ss.total_days_in_month, 31)
|
||||
self.assertEquals(ss.payment_days, 30)
|
||||
@@ -31,7 +31,7 @@ class TestSalarySlip(unittest.TestCase):
|
||||
self.assertEquals(ss.net_pay, 14867.74)
|
||||
|
||||
def test_salary_slip_with_holidays_excluded(self):
|
||||
ss = frappe.bean(copy=test_records[0])
|
||||
ss = frappe.get_doc(copy=test_records[0])
|
||||
ss.insert()
|
||||
self.assertEquals(ss.total_days_in_month, 30)
|
||||
self.assertEquals(ss.payment_days, 29)
|
||||
|
||||
@@ -77,7 +77,7 @@ def get_mapped_doc(source_name, target_doc=None):
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
|
||||
def postprocess(source, target):
|
||||
sal_slip = frappe.bean(target)
|
||||
sal_slip = frappe.get_doc(target)
|
||||
sal_slip.run_method("pull_emp_details")
|
||||
sal_slip.run_method("get_leave_details")
|
||||
sal_slip.run_method("calculate_net_pay")
|
||||
|
||||
Reference in New Issue
Block a user