mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-29 14:48:26 +00:00
This commit is contained in:
@@ -58,7 +58,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
self.update_amc_date(serial_nos, d.end_date)
|
||||
|
||||
if d.sales_person not in email_map:
|
||||
sp = frappe.bean("Sales Person", d.sales_person).make_controller()
|
||||
sp = frappe.get_doc("Sales Person", d.sales_person).make_controller()
|
||||
email_map[d.sales_person] = sp.get_email_id()
|
||||
|
||||
scheduled_date = frappe.db.sql("""select scheduled_date from
|
||||
@@ -69,7 +69,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
if email_map[d.sales_person]:
|
||||
description = "Reference: %s, Item Code: %s and Customer: %s" % \
|
||||
(self.name, d.item_code, self.customer)
|
||||
frappe.bean({
|
||||
frappe.get_doc({
|
||||
"doctype": "Event",
|
||||
"owner": email_map[d.sales_person] or self.owner,
|
||||
"subject": description,
|
||||
@@ -203,7 +203,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
|
||||
def update_amc_date(self, serial_nos, amc_expiry_date=None):
|
||||
for serial_no in serial_nos:
|
||||
serial_no_bean = frappe.bean("Serial No", serial_no)
|
||||
serial_no_bean = frappe.get_doc("Serial No", serial_no)
|
||||
serial_no_bean.amc_expiry_date = amc_expiry_date
|
||||
serial_no_bean.save()
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ def create_lead(email_id):
|
||||
if frappe.db.get_value("Lead", {"email_id": email_id}):
|
||||
return
|
||||
|
||||
lead = frappe.bean({
|
||||
lead = frappe.get_doc({
|
||||
"doctype": "Lead",
|
||||
"email_id": email_id,
|
||||
"lead_name": real_name or email_id,
|
||||
|
||||
@@ -5,7 +5,7 @@ import frappe, unittest
|
||||
|
||||
class TestNewsletter(unittest.TestCase):
|
||||
def test_get_recipients_lead(self):
|
||||
w = frappe.bean(test_records[0])
|
||||
w = frappe.get_doc(test_records[0])
|
||||
w.insert()
|
||||
self.assertTrue("test_lead@example.com" in w.controller.get_recipients())
|
||||
frappe.db.sql("""delete from `tabBulk Email`""")
|
||||
@@ -13,24 +13,24 @@ class TestNewsletter(unittest.TestCase):
|
||||
self.assertTrue(frappe.db.get_value("Bulk Email", {"recipient": "test_lead@example.com"}))
|
||||
|
||||
def test_get_recipients_lead_by_status(self):
|
||||
w = frappe.bean(test_records[0])
|
||||
w = frappe.get_doc(test_records[0])
|
||||
w.lead_status="Converted"
|
||||
w.insert()
|
||||
self.assertTrue("test_lead3@example.com" in w.controller.get_recipients())
|
||||
|
||||
def test_get_recipients_contact_customer(self):
|
||||
w = frappe.bean(test_records[1])
|
||||
w = frappe.get_doc(test_records[1])
|
||||
w.insert()
|
||||
self.assertTrue("test_contact_customer@example.com" in w.controller.get_recipients())
|
||||
|
||||
def test_get_recipients_contact_supplier(self):
|
||||
w = frappe.bean(test_records[1])
|
||||
w = frappe.get_doc(test_records[1])
|
||||
w.contact_type="Supplier"
|
||||
w.insert()
|
||||
self.assertTrue("test_contact_supplier@example.com" in w.controller.get_recipients())
|
||||
|
||||
def test_get_recipients_custom(self):
|
||||
w = frappe.bean(test_records[2])
|
||||
w = frappe.get_doc(test_records[2])
|
||||
w.insert()
|
||||
self.assertTrue("test_custom2@example.com" in w.controller.get_recipients())
|
||||
self.assertTrue(frappe.db.get("Lead",
|
||||
|
||||
@@ -10,7 +10,7 @@ from frappe.core.doctype.communication.communication import _make
|
||||
|
||||
class SupportMailbox(POP3Mailbox):
|
||||
def setup(self, args=None):
|
||||
self.email_settings = frappe.doc("Support Email Settings", "Support Email Settings")
|
||||
self.email_settings = frappe.get_doc("Support Email Settings", "Support Email Settings")
|
||||
self.settings = args or frappe._dict({
|
||||
"use_ssl": self.email_settings.use_ssl,
|
||||
"host": self.email_settings.mail_server,
|
||||
@@ -58,12 +58,12 @@ def get_support_mails():
|
||||
|
||||
def add_support_communication(subject, content, sender, docname=None, mail=None):
|
||||
if docname:
|
||||
ticket = frappe.bean("Support Ticket", docname)
|
||||
ticket = frappe.get_doc("Support Ticket", docname)
|
||||
ticket.status = 'Open'
|
||||
ticket.ignore_permissions = True
|
||||
ticket.save()
|
||||
else:
|
||||
ticket = frappe.bean([decode_dict({
|
||||
ticket = frappe.get_doc([decode_dict({
|
||||
"doctype":"Support Ticket",
|
||||
"description": content,
|
||||
"subject": subject,
|
||||
|
||||
@@ -57,7 +57,7 @@ class SupportTicket(TransactionBase):
|
||||
|
||||
@frappe.whitelist()
|
||||
def set_status(name, status):
|
||||
st = frappe.bean("Support Ticket", name)
|
||||
st = frappe.get_doc("Support Ticket", name)
|
||||
st.status = status
|
||||
st.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user