瀏覽代碼

fix: before install hook for not installing

this is being done as erpnext's patch test needs a bit more thought
it currently installs v14, restores the site to v10 then starts migrating
pull/2/head
phot0n 2 年之前
父節點
當前提交
e279c82e4e
共有 3 個檔案被更改,包括 15 行新增3 行删除
  1. +1
    -1
      payments/hooks.py
  2. +3
    -2
      payments/utils/__init__.py
  3. +11
    -0
      payments/utils/utils.py

+ 1
- 1
payments/hooks.py 查看文件

@@ -63,7 +63,7 @@ app_license = "MIT"
# Installation
# ------------

# before_install = "pay.install.before_install"
before_install = "payments.utils.before_install"
after_install = "payments.utils.make_custom_fields"

# Uninstallation


+ 3
- 2
payments/utils/__init__.py 查看文件

@@ -1,6 +1,7 @@
from payments.utils.utils import (
get_payment_gateway_controller,
before_install,
create_payment_gateway,
make_custom_fields,
delete_custom_fields,
get_payment_gateway_controller,
make_custom_fields,
)

+ 11
- 0
payments/utils/utils.py 查看文件

@@ -2,6 +2,7 @@ import click

import frappe
from frappe import _
from frappe.utils.data import cint
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields


@@ -133,6 +134,8 @@ def make_custom_fields():
]
})

frappe.clear_cache(doctype="Web Form")


def delete_custom_fields():
if frappe.get_meta("Web Form").has_field("payments_tab"):
@@ -156,3 +159,11 @@ def delete_custom_fields():
"Custom Field",
{"name": "Web Form-" + fieldname}
)

frappe.clear_cache(doctype="Web Form")


def before_install():
# only install for v14
if cint(frappe.get_module("frappe").__version__[:2]) < 14 or not frappe.get_meta("Module Def").has_field("custom"):
return False

Loading…
取消
儲存