mirror of
https://gitee.com/yuzelin/erpnext_china.git
synced 2026-03-02 05:14:04 +08:00
company update and insert events, refine readme
This commit is contained in:
10
README.md
10
README.md
@@ -3,8 +3,12 @@
|
||||
|
||||
## 安装
|
||||
|
||||
```
|
||||
没有设置默认站点的,install-app时请加--site参数
|
||||
|
||||
bench get-app erpnext_china https://gitee.com/yuzlin/erpnext_china.git
|
||||
bench install-app erpnext_china
|
||||
```
|
||||
|
||||
|
||||
## 功能说明
|
||||
@@ -57,6 +61,12 @@ bench install-app erpnext_china
|
||||
2. 隐藏本地化不适用字段(如PAN号等印度专用字段)
|
||||
3. 修改默认系统流水码前缀-改短
|
||||
|
||||
## 常见问题
|
||||
|
||||
1. 是否与之前的中文汉化与开箱即用冲突
|
||||
|
||||
建议卸载中文汉化和开箱即用后再安装这个
|
||||
|
||||
#### License
|
||||
|
||||
MIT
|
||||
25
erpnext_china/doc_events.py
Normal file
25
erpnext_china/doc_events.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import frappe
|
||||
from erpnext_china.chart_of_accounts.company_default.utils import set_company_default
|
||||
from erpnext_china.chart_of_accounts.custom_accounts.custom_account import erpnext_china_create_charts
|
||||
|
||||
|
||||
def company_after_insert(doc, method):
|
||||
doc.erpnext_china_in_insert = True
|
||||
|
||||
def company_on_update(doc, method):
|
||||
if not frappe.db.sql(
|
||||
"""select name from tabAccount
|
||||
where company=%s and docstatus<2 limit 1""",
|
||||
doc.name,
|
||||
):
|
||||
if not frappe.local.flags.ignore_chart_of_accounts:
|
||||
frappe.flags.country_change = True
|
||||
frappe.local.flags.ignore_root_company_validation = True
|
||||
frappe.local.flags.ignore_chart_of_accounts = 1
|
||||
zelin_ac_create_charts(doc.name, doc.chart_of_accounts, doc.existing_company)
|
||||
|
||||
if doc.get("erpnext_china_in_insert") and doc.chart_of_accounts and doc.country == "China":
|
||||
try:
|
||||
set_company_default(doc.name)
|
||||
except:
|
||||
frappe.log_error("erpnext_china.doc_events.company_on_update set company default error")
|
||||
@@ -19,3 +19,10 @@ override_whitelisted_methods = {
|
||||
"erpnext.accounts.utils.get_coa": "erpnext_china.chart_of_accounts.custom_accounts.custom_account.get_coa",
|
||||
"frappe.desk.treeview.get_all_nodes": "erpnext_china.chart_of_accounts.custom_accounts.custom_account.get_all_nodes",
|
||||
}
|
||||
|
||||
doc_events = {
|
||||
"Company": {
|
||||
"on_update": "erpnext_china.doc_events.company_on_update",
|
||||
"after_insert": "erpnext_china.doc_events.company_after_insert"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user