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