mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-02 04:58:29 +00:00
model_wrapper is now bean, refactoring defaults
This commit is contained in:
@@ -19,7 +19,7 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.wrapper import copy_doclist
|
||||
from webnotes.model.bean import copy_doclist
|
||||
from webnotes import session, msgprint
|
||||
from webnotes.utils import today
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import webnotes
|
||||
|
||||
from webnotes.utils import add_days, cstr, getdate
|
||||
from webnotes.model.doc import Document, addchild
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import webnotes
|
||||
|
||||
from webnotes.utils import cstr
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.bean import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import webnotes, unittest
|
||||
|
||||
class TestNewsletter(unittest.TestCase):
|
||||
def test_get_recipients_lead(self):
|
||||
w = webnotes.model_wrapper(test_records[0])
|
||||
w = webnotes.bean(test_records[0])
|
||||
w.insert()
|
||||
self.assertTrue("test_lead@example.com" in w.controller.get_recipients())
|
||||
webnotes.conn.sql("""delete from `tabBulk Email`""")
|
||||
@@ -10,24 +10,24 @@ class TestNewsletter(unittest.TestCase):
|
||||
self.assertTrue(webnotes.conn.get_value("Bulk Email", {"recipient": "test_lead@example.com"}))
|
||||
|
||||
def test_get_recipients_lead_by_status(self):
|
||||
w = webnotes.model_wrapper(test_records[0])
|
||||
w = webnotes.bean(test_records[0])
|
||||
w.doc.lead_status="Converted"
|
||||
w.insert()
|
||||
self.assertTrue("test_lead3@example.com" in w.controller.get_recipients())
|
||||
|
||||
def test_get_recipients_contact_customer(self):
|
||||
w = webnotes.model_wrapper(test_records[1])
|
||||
w = webnotes.bean(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 = webnotes.model_wrapper(test_records[1])
|
||||
w = webnotes.bean(test_records[1])
|
||||
w.doc.contact_type="Supplier"
|
||||
w.insert()
|
||||
self.assertTrue("test_contact_supplier@example.com" in w.controller.get_recipients())
|
||||
|
||||
def test_get_recipients_custom(self):
|
||||
w = webnotes.model_wrapper(test_records[2])
|
||||
w = webnotes.bean(test_records[2])
|
||||
w.insert()
|
||||
self.assertTrue("test_custom2@example.com" in w.controller.get_recipients())
|
||||
self.assertTrue(webnotes.conn.get("Lead",
|
||||
|
||||
@@ -38,12 +38,12 @@ class SupportMailbox(POP3Mailbox):
|
||||
ticket = None
|
||||
|
||||
if thread_id and webnotes.conn.exists("Support Ticket", thread_id):
|
||||
ticket = webnotes.model_wrapper("Support Ticket", thread_id)
|
||||
ticket = webnotes.bean("Support Ticket", thread_id)
|
||||
ticket.doc.status = 'Open'
|
||||
ticket.doc.save()
|
||||
|
||||
else:
|
||||
ticket = webnotes.model_wrapper([{
|
||||
ticket = webnotes.bean([{
|
||||
"doctype":"Support Ticket",
|
||||
"description": mail.content,
|
||||
"subject": mail.mail["Subject"],
|
||||
|
||||
@@ -67,7 +67,7 @@ class DocType(TransactionBase):
|
||||
|
||||
@webnotes.whitelist()
|
||||
def set_status(name, status):
|
||||
st = webnotes.model_wrapper("Support Ticket", name)
|
||||
st = webnotes.bean("Support Ticket", name)
|
||||
st.doc.status = status
|
||||
st.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user