From cb8f9a5b8cb508acc64ab0c9e36d835a9dd18a8d Mon Sep 17 00:00:00 2001 From: Tyler Matteson Date: Wed, 21 Sep 2022 14:00:55 -0400 Subject: [PATCH] feat: port to version-14 --- check_run/__init__.py | 2 +- check_run/hooks.py | 3 +- check_run/public/js/check_run.bundle.js | 2 ++ .../js/check_run/check_run_quick_entry.js | 30 +++++++++--------- pyproject.toml | 31 +++++++++++++++++++ requirements.txt | 2 -- setup.py | 20 ++---------- 7 files changed, 54 insertions(+), 36 deletions(-) create mode 100644 check_run/public/js/check_run.bundle.js create mode 100644 pyproject.toml delete mode 100644 requirements.txt diff --git a/check_run/__init__.py b/check_run/__init__.py index 12ab10eb..8c7a179b 100644 --- a/check_run/__init__.py +++ b/check_run/__init__.py @@ -1,3 +1,3 @@ -__version__ = '13.0.0' +__version__ = '14.0.0' diff --git a/check_run/hooks.py b/check_run/hooks.py index 49ef2ead..f2256871 100644 --- a/check_run/hooks.py +++ b/check_run/hooks.py @@ -8,6 +8,7 @@ app_color = "grey" app_email = "support@agritheory.dev" app_license = "MIT" +required_apps = ["erpnext", "hrms"] # Includes in # ------------------ @@ -15,7 +16,7 @@ # include js, css files in header of desk.html # app_include_css = "/assets/check_run/css/check_run.css" app_include_js = [ - "/assets/js/check_run.min.js" + "check_run.bundle.js", ] # include js, css files in header of web template diff --git a/check_run/public/js/check_run.bundle.js b/check_run/public/js/check_run.bundle.js new file mode 100644 index 00000000..71c90e21 --- /dev/null +++ b/check_run/public/js/check_run.bundle.js @@ -0,0 +1,2 @@ +import './check_run/check_run_quick_entry.js' +import './check_run/check_run.js' \ No newline at end of file diff --git a/check_run/public/js/check_run/check_run_quick_entry.js b/check_run/public/js/check_run/check_run_quick_entry.js index f11388f3..dbd256fe 100644 --- a/check_run/public/js/check_run/check_run_quick_entry.js +++ b/check_run/public/js/check_run/check_run_quick_entry.js @@ -1,12 +1,12 @@ -frappe.provide('frappe.ui.form') +frappe.provide('frappe.ui.form'); -frappe.ui.form.CheckRunQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ - init: function (doctype, after_insert) { - this._super(doctype, after_insert) - }, - render_dialog: function () { +frappe.ui.form.CheckRunQuickEntryForm = class CheckRunQuickEntryForm extends frappe.ui.form.QuickEntryForm { + constructor(doctype, after_insert, init_callback, doc, force) { + super(doctype, after_insert, init_callback, doc, force) + } + render_dialog() { this.mandatory = this.get_fields() - this._super() + super.render_dialog(); this.dialog.$wrapper.find('.btn-secondary').hide() this.dialog.fields_dict["bank_account"].get_query = () => { return { @@ -27,8 +27,8 @@ frappe.ui.form.CheckRunQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ this.default_accounts() } this.default_accounts() - }, - get_fields: function () { + } + get_fields() { return [ { label: __("Company"), @@ -52,8 +52,8 @@ frappe.ui.form.CheckRunQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ reqd: 1 } ] - }, - default_accounts: function () { + } + default_accounts() { if (frappe.get_route() && frappe.get_route()[0] == 'Form') { this.dialog.fields_dict["company"] = cur_frm.doc.company this.dialog.fields_dict["pay_to_account"].set_value(cur_frm.doc.pay_to_account) @@ -69,8 +69,8 @@ frappe.ui.form.CheckRunQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ this.dialog.fields_dict["bank_account"].set_value(r.message.name) }) } - }, - register_primary_action: function () { + } + register_primary_action() { const me = this this.dialog.set_primary_action(__('Start Check Run'), () => { let values = me.dialog.get_values() @@ -80,5 +80,5 @@ frappe.ui.form.CheckRunQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ frappe.set_route("Form", "Check Run", r) }) }) - }, -}) + } +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..ff1364df --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,31 @@ +[project] +name = "check_run" +authors = [ + { name = "AgriTheory", email = "support@agritheory.dev"} +] +description = "Payables utility for ERPNext" +requires-python = ">=3.10" +readme = "README.md" +dynamic = ["version"] +dependencies = [ + "atnacha @ git+https://github.com/AgriTheory/atnacha.git@main#egg=atnacha" +] + +[build-system] +requires = ["flit_core >=3.4,<4"] +build-backend = "flit_core.buildapi" + +[tool.bench.dev-dependencies] +hypothesis = "~=6.31.0" + +[tool.black] +line-length = 99 + +[tool.isort] +line_length = 99 +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true +indent = "\t" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index aaef3699..00000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -# frappe -- https://github.com/frappe/frappe is installed via 'bench init' -atnacha @ git+https://github.com/AgriTheory/atnacha.git@main#egg=atnacha \ No newline at end of file diff --git a/setup.py b/setup.py index 8fc4525e..55bd3082 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,5 @@ -from setuptools import setup, find_packages +from setuptools import setup -with open("requirements.txt") as f: - install_requires = f.read().strip().split("\n") +name = "check_run" -# get version from __version__ variable in check_run/__init__.py -from check_run import __version__ as version - -setup( - name="check_run", - version=version, - description="Payables Utilities for ERPNext", - author="AgriTheory", - author_email="support@agritheory.dev", - packages=find_packages(), - zip_safe=False, - include_package_data=True, - install_requires=install_requires -) +setup()