支持供应商简称维护和订单PDF下载命名

This commit is contained in:
reddaniel110
2026-09-17 10:52:36 +08:00
parent 62cd117379
commit a86f0b0d5b
12 changed files with 227 additions and 21 deletions
+8 -3
View File
@@ -14,7 +14,7 @@ def upgrade_database(path):
if 'orders' not in tables:
return
version = con.execute('PRAGMA user_version').fetchone()[0]
if version >= 4:
if version >= 5:
return
duplicates = con.execute('SELECT order_no, COUNT(*) FROM orders GROUP BY order_no HAVING COUNT(*) > 1').fetchall()
if duplicates:
@@ -28,8 +28,13 @@ def upgrade_database(path):
upgrade_fixed_amounts(con)
if version < 3:
merge_approval(con, tables)
add_tracking(con)
con.execute('PRAGMA user_version=4')
if version < 4:
add_tracking(con)
if 'suppliers' in tables:
columns = {row[1] for row in con.execute('PRAGMA table_info(suppliers)')}
if 'short_name' not in columns:
con.execute("ALTER TABLE suppliers ADD COLUMN short_name VARCHAR(60) NOT NULL DEFAULT ''")
con.execute('PRAGMA user_version=5')
con.commit()
except Exception:
con.rollback()