From 1a5e35b581b40610cd3d69622b0c1618a506c5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=88=99=E9=9C=96?= <7624863+yuzelin@user.noreply.gitee.com> Date: Wed, 4 Feb 2026 23:56:26 +0800 Subject: [PATCH] =?UTF-8?q?Payment=E5=9C=A8=E9=87=87=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=EF=BC=8C=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E4=B8=8E?= =?UTF-8?q?=E9=94=80=E5=94=AE=E5=8F=91=E7=A5=A8=E4=B8=AD=E6=B1=89=E5=8C=96?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erpnext_china/__init__.py | 2 +- erpnext_china/hooks.py | 6 ++++++ erpnext_china/public/js/purchase_order.js | 13 +++++++++++++ erpnext_china/public/js/sales_invoice.js | 13 +++++++++++++ erpnext_china/public/js/sales_order.js | 13 +++++++++++++ erpnext_china/translations/zh.csv | 3 ++- 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 erpnext_china/public/js/purchase_order.js create mode 100644 erpnext_china/public/js/sales_invoice.js create mode 100644 erpnext_china/public/js/sales_order.js diff --git a/erpnext_china/__init__.py b/erpnext_china/__init__.py index 148b794..21c0ab3 100644 --- a/erpnext_china/__init__.py +++ b/erpnext_china/__init__.py @@ -7,7 +7,7 @@ import frappe patches_loaded = False -__version__ = '1.0.5' +__version__ = '1.0.6' def load_monkey_patches(): diff --git a/erpnext_china/hooks.py b/erpnext_china/hooks.py index bcb17f2..366245f 100644 --- a/erpnext_china/hooks.py +++ b/erpnext_china/hooks.py @@ -11,6 +11,12 @@ after_install = "erpnext_china.setup.install.after_install" setup_wizard_requires = "assets/erpnext_china/js/setup_wizard.js" +doctype_js = { + "Purchase Order" : "public/js/purchase_order.js", + "Sales Order" : "public/js/sales_order.js", + "Sales Invoice" : "public/js/sales_invoice.js", +} + override_whitelisted_methods = { "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.get_charts_for_country": "erpnext_china.chart_of_accounts.custom_accounts.custom_account.get_charts_for_country", diff --git a/erpnext_china/public/js/purchase_order.js b/erpnext_china/public/js/purchase_order.js new file mode 100644 index 0000000..957d28f --- /dev/null +++ b/erpnext_china/public/js/purchase_order.js @@ -0,0 +1,13 @@ +frappe.ui.form.on('Purchase Order', { + refresh: function(frm) { + // 使用 setTimeout 是因为 ERPNext 的按钮是动态渲染的 + // 必须等核心代码渲染完,我们才能抓取到 DOM + setTimeout(() => { + // 定位:在“创建”按钮组下,寻找 data-label 为“付款”的选项 + // 使用 decodeURIComponent 是为了增强可读性,也可以直接用 data-label="付款" + $(`.inner-group-button[data-label='${encodeURIComponent("创建")}']`) + .find(`.dropdown-item[data-label='${encodeURIComponent("付款")}']`) + .text(__('预付款')); + }, 200); + } +}); \ No newline at end of file diff --git a/erpnext_china/public/js/sales_invoice.js b/erpnext_china/public/js/sales_invoice.js new file mode 100644 index 0000000..fc1af4b --- /dev/null +++ b/erpnext_china/public/js/sales_invoice.js @@ -0,0 +1,13 @@ +frappe.ui.form.on('Sales Invoice', { + refresh: function(frm) { + // 使用 setTimeout 是因为 ERPNext 的按钮是动态渲染的 + // 必须等核心代码渲染完,我们才能抓取到 DOM + setTimeout(() => { + // 定位:在“创建”按钮组下,寻找 data-label 为“付款”的选项 + // 使用 decodeURIComponent 是为了增强可读性,也可以直接用 data-label="付款" + $(`.inner-group-button[data-label='${encodeURIComponent("创建")}']`) + .find(`.dropdown-item[data-label='${encodeURIComponent("付款")}']`) + .text(__('收款')); + }, 200); + } +}); \ No newline at end of file diff --git a/erpnext_china/public/js/sales_order.js b/erpnext_china/public/js/sales_order.js new file mode 100644 index 0000000..06c9d8d --- /dev/null +++ b/erpnext_china/public/js/sales_order.js @@ -0,0 +1,13 @@ +frappe.ui.form.on('Sales Order', { + refresh: function(frm) { + // 使用 setTimeout 是因为 ERPNext 的按钮是动态渲染的 + // 必须等核心代码渲染完,我们才能抓取到 DOM + setTimeout(() => { + // 定位:在“创建”按钮组下,寻找 data-label 为“付款”的选项 + // 使用 decodeURIComponent 是为了增强可读性,也可以直接用 data-label="付款" + $(`.inner-group-button[data-label='${encodeURIComponent("创建")}']`) + .find(`.dropdown-item[data-label='${encodeURIComponent("付款")}']`) + .text(__('预收款')); + }, 200); + } +}); \ No newline at end of file diff --git a/erpnext_china/translations/zh.csv b/erpnext_china/translations/zh.csv index 0e78219..8420966 100644 --- a/erpnext_china/translations/zh.csv +++ b/erpnext_china/translations/zh.csv @@ -12134,4 +12134,5 @@ Right Column,右栏 Row {0}: Account {1} already in Row {2},行次 {0}:科目 {1} 已在行次 {2} 中使用。 Row {0}: '{1}' is not a valid row number,行次 {0}:'{1}' 不是有效的数字。 {0}Row {1},{0}第 {1} 行 -{0}: Account {1} already in {2},{0}:科目 {1} 已在 {2} 中使用 \ No newline at end of file +{0}: Account {1} already in {2},{0}:科目 {1} 已在 {2} 中使用 +Include Returned Invoices (Stand-alone),含独立红字发票 \ No newline at end of file