[fix] remove prints
This commit is contained in:
parent
d4fd3efef4
commit
dcaf5f98af
6 changed files with 79 additions and 76 deletions
|
|
@ -162,18 +162,13 @@ class TestUser(unittest.TestCase):
|
|||
# from frappe.frappeclient import FrappeClient
|
||||
# update_site_config('deny_multiple_sessions', 0)
|
||||
#
|
||||
# print 'conn1'
|
||||
# conn1 = FrappeClient(get_url(), "test@example.com", "Eastern_43A1W", verify=False)
|
||||
# test_request(conn1)
|
||||
#
|
||||
# print 'conn2'
|
||||
# conn2 = FrappeClient(get_url(), "test@example.com", "Eastern_43A1W", verify=False)
|
||||
# test_request(conn2)
|
||||
#
|
||||
# update_site_config('deny_multiple_sessions', 1)
|
||||
#
|
||||
# print 'conn3'
|
||||
#
|
||||
# conn3 = FrappeClient(get_url(), "test@example.com", "Eastern_43A1W", verify=False)
|
||||
# test_request(conn3)
|
||||
#
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_simple(self):
|
||||
fixture = "Custom Script"
|
||||
path = frappe.scrub(fixture) + "_original_style.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -24,7 +24,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_simple_name_equal_default(self):
|
||||
fixture = ["Custom Script", {"name":["Item-Client"]}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_equal_default.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -32,7 +32,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_simple_name_equal(self):
|
||||
fixture = ["Custom Script", {"name":["Item-Client"],"op":"="}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -40,7 +40,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_simple_name_not_equal(self):
|
||||
fixture = ["Custom Script", {"name":["Item-Client"],"op":"!="}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_not_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -49,7 +49,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_simple_name_at_least_equal(self):
|
||||
fixture = ["Custom Script", {"name":"Item-Cli"}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_at_least_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -57,7 +57,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_multi_name_equal(self):
|
||||
fixture = ["Custom Script", {"name":["Item-Client", "Customer-Client"],"op":"="}]
|
||||
path = frappe.scrub(fixture[0]) + "_multi_name_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -65,7 +65,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_multi_name_not_equal(self):
|
||||
fixture = ["Custom Script", {"name":["Item-Client", "Customer-Client"],"op":"!="}]
|
||||
path = frappe.scrub(fixture[0]) + "_multi_name_not_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -73,7 +73,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_empty_object(self):
|
||||
fixture = ["Custom Script", {}]
|
||||
path = frappe.scrub(fixture[0]) + "_empty_object_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -81,7 +81,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_just_list(self):
|
||||
fixture = ["Custom Script"]
|
||||
path = frappe.scrub(fixture[0]) + "_just_list_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -90,7 +90,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_rex_no_flags(self):
|
||||
fixture = ["Custom Script", {"name":r"^[i|A]"}]
|
||||
path = frappe.scrub(fixture[0]) + "_rex_no_flags.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -98,7 +98,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Script_fixture_rex_with_flags(self):
|
||||
fixture = ["Custom Script", {"name":r"^[i|A]", "flags":"L,M"}]
|
||||
path = frappe.scrub(fixture[0]) + "_rex_with_flags.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -107,7 +107,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_simple(self):
|
||||
fixture = "Custom Field"
|
||||
path = frappe.scrub(fixture) + "_original_style.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -115,7 +115,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_simple_name_equal_default(self):
|
||||
fixture = ["Custom Field", {"name":["Item-vat"]}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_equal_default.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -123,7 +123,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_simple_name_equal(self):
|
||||
fixture = ["Custom Field", {"name":["Item-vat"],"op":"="}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -131,7 +131,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_simple_name_not_equal(self):
|
||||
fixture = ["Custom Field", {"name":["Item-vat"],"op":"!="}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_not_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -140,7 +140,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_simple_name_at_least_equal(self):
|
||||
fixture = ["Custom Field", {"name":"Item-va"}]
|
||||
path = frappe.scrub(fixture[0]) + "_simple_name_at_least_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -148,7 +148,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_multi_name_equal(self):
|
||||
fixture = ["Custom Field", {"name":["Item-vat", "Bin-vat"],"op":"="}]
|
||||
path = frappe.scrub(fixture[0]) + "_multi_name_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -156,7 +156,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_multi_name_not_equal(self):
|
||||
fixture = ["Custom Field", {"name":["Item-vat", "Bin-vat"],"op":"!="}]
|
||||
path = frappe.scrub(fixture[0]) + "_multi_name_not_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -164,7 +164,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_empty_object(self):
|
||||
fixture = ["Custom Field", {}]
|
||||
path = frappe.scrub(fixture[0]) + "_empty_object_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -172,7 +172,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_just_list(self):
|
||||
fixture = ["Custom Field"]
|
||||
path = frappe.scrub(fixture[0]) + "_just_list_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -181,7 +181,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_rex_no_flags(self):
|
||||
fixture = ["Custom Field", {"name":r"^[r|L]"}]
|
||||
path = frappe.scrub(fixture[0]) + "_rex_no_flags.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -189,7 +189,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Custom_Field_fixture_rex_with_flags(self):
|
||||
fixture = ["Custom Field", {"name":r"^[i|A]", "flags":"L,M"}]
|
||||
path = frappe.scrub(fixture[0]) + "_rex_with_flags.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -199,7 +199,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_simple(self):
|
||||
fixture = "ToDo"
|
||||
path = "Doctype_" + frappe.scrub(fixture) + "_original_style_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -207,7 +207,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_simple_name_equal_default(self):
|
||||
fixture = ["ToDo", {"name":["TDI00000008"]}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_simple_name_equal_default.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -215,7 +215,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_simple_name_equal(self):
|
||||
fixture = ["ToDo", {"name":["TDI00000002"],"op":"="}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_simple_name_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -223,7 +223,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_simple_name_not_equal(self):
|
||||
fixture = ["ToDo", {"name":["TDI00000002"],"op":"!="}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_simple_name_not_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -232,7 +232,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_simple_name_at_least_equal(self):
|
||||
fixture = ["ToDo", {"name":"TDI"}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_simple_name_at_least_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -240,7 +240,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_multi_name_equal(self):
|
||||
fixture = ["ToDo", {"name":["TDI00000002", "TDI00000008"],"op":"="}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_multi_name_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -248,7 +248,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_multi_name_not_equal(self):
|
||||
fixture = ["ToDo", {"name":["TDI00000002", "TDI00000008"],"op":"!="}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_multi_name_not_equal.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -256,7 +256,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_empty_object(self):
|
||||
fixture = ["ToDo", {}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_empty_object_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -264,7 +264,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_just_list(self):
|
||||
fixture = ["ToDo"]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_just_list_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -273,7 +273,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_rex_no_flags(self):
|
||||
fixture = ["ToDo", {"name":r"^TDi"}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_rex_no_flags_should_be_all.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
@ -281,7 +281,7 @@ class TestDataImportFixtures(unittest.TestCase):
|
|||
def test_Doctype_fixture_rex_with_flags(self):
|
||||
fixture = ["ToDo", {"name":r"^TDi", "flags":"L,M"}]
|
||||
path = "Doctype_" + frappe.scrub(fixture[0]) + "_rex_with_flags_should_be_none.csv"
|
||||
# print "teste done {}".format(path)
|
||||
<!-- redirect: /pricing/support-->
|
||||
export_csv(fixture, path)
|
||||
self.assertTrue(True)
|
||||
os.remove(path)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
|
||||
def run_webhooks(doc, method):
|
||||
'''Run webhooks for this method'''
|
||||
if frappe.flags.in_import or frappe.flags.in_patch or frappe.flags.in_install:
|
||||
return
|
||||
|
||||
if not getattr(frappe.local, 'webhooks_executed', None):
|
||||
frappe.local.webhooks_executed = []
|
||||
|
||||
if doc.flags.webhooks == None:
|
||||
webhooks = frappe.cache().hget('webhooks', doc.doctype)
|
||||
if webhooks==None:
|
||||
webhooks = frappe.get_all('Webhook',
|
||||
fields=["name", "webhook_docevent", "webhook_doctype"])
|
||||
frappe.cache().hset('webhooks', doc.doctype, webhooks)
|
||||
doc.flags.webhooks = webhooks
|
||||
|
||||
if not doc.flags.webhooks:
|
||||
return
|
||||
|
||||
def _webhook_request(webhook):
|
||||
if not webhook.name in frappe.local.webhooks_executed:
|
||||
frappe.enqueue("frappe.integrations.doctype.webhook.webhook.enqueue_webhook", doc=doc, webhook=webhook)
|
||||
frappe.local.webhooks_executed.append(webhook.name)
|
||||
|
||||
event_list = ["on_update", "after_insert", "on_submit", "on_cancel", "on_trash"]
|
||||
|
||||
if not doc.flags.in_insert:
|
||||
# value change is not applicable in insert
|
||||
event_list.append('on_change')
|
||||
event_list.append('before_update_after_submit')
|
||||
|
||||
for webhook in doc.flags.webhooks:
|
||||
event = method if method in event_list else None
|
||||
if event and webhook.webhook_docevent == event and webhook.webhook_doctype == doc.doctype:
|
||||
_webhook_request(webhook)
|
||||
|
|
@ -13,15 +13,18 @@ from time import sleep
|
|||
class Webhook(Document):
|
||||
def autoname(self):
|
||||
self.name = self.webhook_doctype + "-" + self.webhook_docevent
|
||||
|
||||
def validate(self):
|
||||
self.validate_docevent()
|
||||
self.validate_request_url()
|
||||
self.validate_repeating_fields()
|
||||
|
||||
def validate_docevent(self):
|
||||
if self.webhook_doctype:
|
||||
is_submittable = frappe.get_value("DocType", self.webhook_doctype, "is_submittable")
|
||||
if not is_submittable and self.webhook_docevent in ["on_submit", "on_cancel", "on_update_after_submit"]:
|
||||
frappe.throw(_("DocType must be Submittable for the selected Doc Event"))
|
||||
|
||||
def validate_request_url(self):
|
||||
try:
|
||||
request_url = urlparse(self.request_url).netloc
|
||||
|
|
@ -29,6 +32,7 @@ class Webhook(Document):
|
|||
raise frappe.ValidationError
|
||||
except Exception as e:
|
||||
frappe.throw(_("Check Request URL"), exc=e)
|
||||
|
||||
def validate_repeating_fields(self):
|
||||
"""Error when Same Field is entered multiple times in webhook_data"""
|
||||
webhook_data = []
|
||||
|
|
@ -64,39 +68,3 @@ def enqueue_webhook(doc, webhook):
|
|||
continue
|
||||
else:
|
||||
raise e
|
||||
|
||||
def run_webhooks(doc, method):
|
||||
'''Run webhooks for this method'''
|
||||
if frappe.flags.in_import or frappe.flags.in_patch or frappe.flags.in_install:
|
||||
return
|
||||
|
||||
if not getattr(frappe.local, 'webhooks_executed', None):
|
||||
frappe.local.webhooks_executed = []
|
||||
|
||||
if doc.flags.webhooks == None:
|
||||
webhooks = frappe.cache().hget('webhooks', doc.doctype)
|
||||
if webhooks==None:
|
||||
webhooks = frappe.get_all('Webhook',
|
||||
fields=["name", "webhook_docevent", "webhook_doctype"])
|
||||
frappe.cache().hset('webhooks', doc.doctype, webhooks)
|
||||
doc.flags.webhooks = webhooks
|
||||
|
||||
if not doc.flags.webhooks:
|
||||
return
|
||||
|
||||
def _webhook_request(webhook):
|
||||
if not webhook.name in frappe.local.webhooks_executed:
|
||||
frappe.enqueue("frappe.integrations.doctype.webhook.webhook.enqueue_webhook", doc=doc, webhook=webhook)
|
||||
frappe.local.webhooks_executed.append(webhook.name)
|
||||
|
||||
event_list = ["on_update", "after_insert", "on_submit", "on_cancel", "on_trash"]
|
||||
|
||||
if not doc.flags.in_insert:
|
||||
# value change is not applicable in insert
|
||||
event_list.append('on_change')
|
||||
event_list.append('before_update_after_submit')
|
||||
|
||||
for webhook in doc.flags.webhooks:
|
||||
event = method if method in event_list else None
|
||||
if event and webhook.webhook_docevent == event and webhook.webhook_doctype == doc.doctype:
|
||||
_webhook_request(webhook)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import hashlib, json
|
|||
from frappe.model import optional_fields
|
||||
from frappe.utils.file_manager import save_url
|
||||
from frappe.utils.global_search import update_global_search
|
||||
from frappe.integrations.doctype.webhook import run_webhooks
|
||||
|
||||
# once_only validation
|
||||
# methods
|
||||
|
|
@ -673,7 +674,6 @@ class Document(BaseDocument):
|
|||
out = Document.hook(fn)(self, *args, **kwargs)
|
||||
|
||||
self.run_email_alerts(method)
|
||||
from frappe.integrations.doctype.webhook.webhook import run_webhooks
|
||||
run_webhooks(self, method)
|
||||
|
||||
return out
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ from frappe.utils import cint
|
|||
@frappe.whitelist()
|
||||
def add(doctype, name, user=None, read=1, write=0, share=0, everyone=0, flags=None, notify=0):
|
||||
"""Share the given document with a user."""
|
||||
print notify, share
|
||||
if not user:
|
||||
user = frappe.session.user
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue