Преглед на файлове

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

Зареждане…
Отказ
Запис