ソースを参照

[fix] [test] for notification

version-14
Rushabh Mehta 7年前
コミット
e180b41366
6個のファイルの変更18行の追加13行の削除
  1. +1
    -1
      frappe/email/doctype/notification/notification.py
  2. +2
    -1
      frappe/integrations/doctype/stripe_settings/stripe_settings.py
  3. +9
    -9
      frappe/patches/v5_0/fix_email_alert.py
  4. +1
    -1
      frappe/patches/v5_0/rename_table_fieldnames.py
  5. +1
    -1
      frappe/patches/v5_0/v4_to_v5.py
  6. +4
    -0
      frappe/utils/install.py

+ 1
- 1
frappe/email/doctype/notification/notification.py ファイルの表示

@@ -42,9 +42,9 @@ class Notification(Document):
self.validate_forbidden_types()
self.validate_condition()
self.validate_standard()
frappe.cache().hdel('notifications', self.document_type)

def on_update(self):
frappe.cache().hdel('email_alerts', self.document_type)
path = export_module_json(self, self.is_standard, self.module)
if path:
# js


+ 2
- 1
frappe/integrations/doctype/stripe_settings/stripe_settings.py ファイルの表示

@@ -9,7 +9,6 @@ from frappe import _
from six.moves.urllib.parse import urlencode
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
import stripe

class StripeSettings(Document):
supported_currencies = [
@@ -58,6 +57,7 @@ class StripeSettings(Document):
return get_url("./integrations/stripe_checkout?{0}".format(urlencode(kwargs)))

def create_request(self, data):
import stripe
self.data = frappe._dict(data)
stripe.api_key = self.get_password(fieldname="secret_key", raise_exception=False)
stripe.default_http_client = stripe.http_client.RequestsClient()
@@ -74,6 +74,7 @@ class StripeSettings(Document):
}

def create_charge_on_stripe(self):
import stripe
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)



+ 9
- 9
frappe/patches/v5_0/fix_email_alert.py ファイルの表示

@@ -3,14 +3,14 @@ from __future__ import unicode_literals
import frappe

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:
email_alert.event = "Days Before"
notification.event = "Days Before"

email_alert.save()
notification.save()

+ 1
- 1
frappe/patches/v5_0/rename_table_fieldnames.py ファイルの表示

@@ -20,7 +20,7 @@ rename_map = {

def execute():
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("workflow", "doctype", "workflow")



+ 1
- 1
frappe/patches/v5_0/v4_to_v5.py ファイルの表示

@@ -9,7 +9,7 @@ def execute():
("desk", ("feed", "event", "todo", "note")),
("custom", ("custom_field", "custom_script", "customize_form",
"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")),
("print", ("letter_head", "print_format", "print_settings"))
)


+ 4
- 0
frappe/utils/install.py ファイルの表示

@@ -39,6 +39,10 @@ def after_install():
# setup wizard now in frappe
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()

def install_basic_docs():


読み込み中…
キャンセル
保存