@@ -42,9 +42,9 @@ class Notification(Document): | |||||
self.validate_forbidden_types() | self.validate_forbidden_types() | ||||
self.validate_condition() | self.validate_condition() | ||||
self.validate_standard() | self.validate_standard() | ||||
frappe.cache().hdel('notifications', self.document_type) | |||||
def on_update(self): | def on_update(self): | ||||
frappe.cache().hdel('email_alerts', self.document_type) | |||||
path = export_module_json(self, self.is_standard, self.module) | path = export_module_json(self, self.is_standard, self.module) | ||||
if path: | if path: | ||||
# js | # js | ||||
@@ -9,7 +9,6 @@ from frappe import _ | |||||
from six.moves.urllib.parse import urlencode | from six.moves.urllib.parse import urlencode | ||||
from frappe.utils import get_url, call_hook_method, cint, flt | from frappe.utils import get_url, call_hook_method, cint, flt | ||||
from frappe.integrations.utils import make_get_request, make_post_request, create_request_log, create_payment_gateway | from frappe.integrations.utils import make_get_request, make_post_request, create_request_log, create_payment_gateway | ||||
import stripe | |||||
class StripeSettings(Document): | class StripeSettings(Document): | ||||
supported_currencies = [ | supported_currencies = [ | ||||
@@ -58,6 +57,7 @@ class StripeSettings(Document): | |||||
return get_url("./integrations/stripe_checkout?{0}".format(urlencode(kwargs))) | return get_url("./integrations/stripe_checkout?{0}".format(urlencode(kwargs))) | ||||
def create_request(self, data): | def create_request(self, data): | ||||
import stripe | |||||
self.data = frappe._dict(data) | self.data = frappe._dict(data) | ||||
stripe.api_key = self.get_password(fieldname="secret_key", raise_exception=False) | stripe.api_key = self.get_password(fieldname="secret_key", raise_exception=False) | ||||
stripe.default_http_client = stripe.http_client.RequestsClient() | stripe.default_http_client = stripe.http_client.RequestsClient() | ||||
@@ -74,6 +74,7 @@ class StripeSettings(Document): | |||||
} | } | ||||
def create_charge_on_stripe(self): | def create_charge_on_stripe(self): | ||||
import stripe | |||||
try: | try: | ||||
charge = stripe.Charge.create(amount=cint(flt(self.data.amount)*100), currency=self.data.currency, source=self.data.stripe_token_id, description=self.data.description) | charge = stripe.Charge.create(amount=cint(flt(self.data.amount)*100), currency=self.data.currency, source=self.data.stripe_token_id, description=self.data.description) | ||||
@@ -3,14 +3,14 @@ from __future__ import unicode_literals | |||||
import frappe | import frappe | ||||
def execute(): | def execute(): | ||||
frappe.reload_doctype("Email Alert") | |||||
for e in frappe.get_all("Email Alert"): | |||||
email_alert = frappe.get_doc("Email Alert", e.name) | |||||
if email_alert.event == "Date Change": | |||||
if email_alert.days_in_advance < 0: | |||||
email_alert.event = "Days After" | |||||
email_alert.days_in_advance = -email_alert.days_in_advance | |||||
frappe.reload_doctype("Notification") | |||||
for e in frappe.get_all("Notification"): | |||||
notification = frappe.get_doc("Notification", e.name) | |||||
if notification.event == "Date Change": | |||||
if notification.days_in_advance < 0: | |||||
notification.event = "Days After" | |||||
notification.days_in_advance = -email_alert.days_in_advance | |||||
else: | else: | ||||
email_alert.event = "Days Before" | |||||
notification.event = "Days Before" | |||||
email_alert.save() | |||||
notification.save() |
@@ -20,7 +20,7 @@ rename_map = { | |||||
def execute(): | def execute(): | ||||
frappe.reload_doc("custom", "doctype", "customize_form") | frappe.reload_doc("custom", "doctype", "customize_form") | ||||
frappe.reload_doc("email", "doctype", "email_alert") | |||||
frappe.reload_doc("email", "doctype", "notification") | |||||
frappe.reload_doc("desk", "doctype", "event") | frappe.reload_doc("desk", "doctype", "event") | ||||
frappe.reload_doc("workflow", "doctype", "workflow") | frappe.reload_doc("workflow", "doctype", "workflow") | ||||
@@ -9,7 +9,7 @@ def execute(): | |||||
("desk", ("feed", "event", "todo", "note")), | ("desk", ("feed", "event", "todo", "note")), | ||||
("custom", ("custom_field", "custom_script", "customize_form", | ("custom", ("custom_field", "custom_script", "customize_form", | ||||
"customize_form_field", "property_setter")), | "customize_form_field", "property_setter")), | ||||
("email", ("email_queue", "email_alert", "email_alert_recipient", "standard_reply")), | |||||
("email", ("email_queue", "notification", "notification_recipient", "standard_reply")), | |||||
("geo", ("country", "currency")), | ("geo", ("country", "currency")), | ||||
("print", ("letter_head", "print_format", "print_settings")) | ("print", ("letter_head", "print_format", "print_settings")) | ||||
) | ) | ||||
@@ -39,6 +39,10 @@ def after_install(): | |||||
# setup wizard now in frappe | # setup wizard now in frappe | ||||
frappe.db.set_default('desktop:home_page', 'setup-wizard') | frappe.db.set_default('desktop:home_page', 'setup-wizard') | ||||
# clear test log | |||||
with open(frappe.get_site_path('.test_log'), 'w') as f: | |||||
f.write('') | |||||
frappe.db.commit() | frappe.db.commit() | ||||
def install_basic_docs(): | def install_basic_docs(): | ||||