新增订单收票付款交货跟进并完善使用升级手册
增加部分付款和部分交货状态、工作台筛选、权限校验、跟进记录及 v4 数据迁移;补充 Windows EXE 构建与验收脚本。附 16 页 PDF 使用升级手册及企业微信详细配置说明、生成脚本和测试截图。验证:76 项回归测试、EXE 浏览器验收与 PDF 逐页校验通过。
This commit is contained in:
+24
-3
@@ -14,7 +14,7 @@ def upgrade_database(path):
|
||||
if 'orders' not in tables:
|
||||
return
|
||||
version = con.execute('PRAGMA user_version').fetchone()[0]
|
||||
if version >= 3:
|
||||
if version >= 4:
|
||||
return
|
||||
duplicates = con.execute('SELECT order_no, COUNT(*) FROM orders GROUP BY order_no HAVING COUNT(*) > 1').fetchall()
|
||||
if duplicates:
|
||||
@@ -26,14 +26,35 @@ def upgrade_database(path):
|
||||
try:
|
||||
if version < 2:
|
||||
upgrade_fixed_amounts(con)
|
||||
merge_approval(con, tables)
|
||||
con.execute('PRAGMA user_version=3')
|
||||
if version < 3:
|
||||
merge_approval(con, tables)
|
||||
add_tracking(con)
|
||||
con.execute('PRAGMA user_version=4')
|
||||
con.commit()
|
||||
except Exception:
|
||||
con.rollback()
|
||||
raise
|
||||
|
||||
|
||||
def add_tracking(con):
|
||||
# Historical invoices, payments and deliveries are unknown until recorded.
|
||||
additions = {
|
||||
'needs_prepayment': 'BOOLEAN NOT NULL DEFAULT 0',
|
||||
'invoice_status': "VARCHAR(20) NOT NULL DEFAULT 'unknown'",
|
||||
'delivery_status': "VARCHAR(20) NOT NULL DEFAULT 'unknown'",
|
||||
'payment_status': "VARCHAR(20) NOT NULL DEFAULT 'unknown'",
|
||||
'payment_date': "VARCHAR(10) NOT NULL DEFAULT ''",
|
||||
'fulfillment_note': "TEXT NOT NULL DEFAULT ''",
|
||||
'payment_note': "TEXT NOT NULL DEFAULT ''",
|
||||
'fulfillment_revision': 'INTEGER NOT NULL DEFAULT -1',
|
||||
'payment_revision': 'INTEGER NOT NULL DEFAULT -1',
|
||||
}
|
||||
existing = {row[1] for row in con.execute('PRAGMA table_info(orders)')}
|
||||
for name, definition in additions.items():
|
||||
if name not in existing:
|
||||
con.execute('ALTER TABLE orders ADD COLUMN %s %s' % (name, definition))
|
||||
|
||||
|
||||
def upgrade_fixed_amounts(con):
|
||||
additions = {
|
||||
'users': {'session_version': 'INTEGER NOT NULL DEFAULT 1', 'must_change_password': 'BOOLEAN NOT NULL DEFAULT 1'},
|
||||
|
||||
Reference in New Issue
Block a user