20 Commits

Author SHA1 Message Date
d3310bfcc1 fix: 修正刷新目标为 app.sage_main_content
Sage 主内容区 ID 是 sage_main_content 而非 main_content。
global_menu.ui 确认: target = app.sage_main_content
2026-06-29 13:24:43 +08:00
982b0ad7a7 fix: 授信表单提交成功后自动刷新客户额度管理页面
set_credit_form.ui 添加 submited 事件绑定:
Form 提交成功 → 替换 main_content 为最新 credit_manage.ui
PopupWindow 同时因 dismiss_events:["submited"] 自动关闭

适用于新增授信和调整授信两个场景
2026-06-29 13:18:44 +08:00
bda9e7fc00 feat: credit_limit 加 grant_orgid 授予机构字段,支持多租户
credit_limit 新增 grant_orgid 字段,区分「客户所属机构(orgid)」
与「授予信用的机构(grant_orgid)」。多租户下,操作员为客户授信时:
- orgid = 客户机构ID
- grant_orgid = 操作员所属机构ID

修改:
- models/credit_limit.json: 加 grant_orgid 字段(VARCHAR(32), default 0) + 索引
- creditlimit.py:
  get_credit_stats/get_all_customer_credits: WHERE orgid → WHERE grant_orgid
  set_credit_limit: 加 grant_orgid 参数
- set_customer_credit.dspy: 写入时 orgid=客户orgid, grant_orgid=操作员orgid;
  三处UPDATE同步加 grant_orgid
- credit_summary.dspy: WHERE orgid → WHERE grant_orgid

get_my_credit_list(客户自看)保持按 cl.orgid 过滤不变。
2026-06-29 12:46:49 +08:00
b880673d79 fix: credit_manage 弹窗提交后不关闭导致重复提交
set_credit_form.ui 用了无效的 actiontype:'close' 来关闭弹窗,
表单提交后弹窗不关,操作员以为失败重复提交。

修复:
- set_credit_form.ui: 移除无效的 actiontype:'close' bind
- credit_manage.ui: popup_options.dismiss_events 加上'submited',
  Form 提交成功后自动关闭弹窗(2处弹窗:新增授信 + 调整)
2026-06-29 11:55:39 +08:00
77fd157ab7 fix: revert get_credit_limit.dspy to CRUD auto-generated, add to .gitignore
The file was manually rewritten in cd26eb1 instead of modifying the
CRUD definition (json/credit_limit.json) and regenerating.

Changes:
- Reverted get_credit_limit.dspy to xls2crud-generated version
  (includes JOINs for _text fields from model codes, DBFilter pattern)
- Re-generated index.ui via xls2crud
- Added auto-generated credit_limit files to .gitignore
  (index.ui, get/add/update/delete_credit_limit.dspy)
- Removed them from git tracking

Future modifications should go through json/credit_limit.json
or models/credit_limit.json, then regenerate.
2026-06-29 11:35:24 +08:00
cd26eb1852 fix: 重写get_credit_limit移除default_filterjson; set_customer_credit加try/except防Duplicate 500 2026-06-29 10:55:12 +08:00
4ca0243506 fix: 新增授信改为UPSERT,避免accountid唯一约束冲突;uuid改为getID 2026-06-29 10:51:16 +08:00
31ef3531c8 fix: add dismiss_events to all PopupWindows in accounting module
All PopupWindows loading Form widgets now include 'dismiss_events: ["cancel"]'
so the Form Cancel button properly closes the popup instead of doing nothing.

- credit_manage.ui: '新增授信' and '调整' popups
- error_accounting.ui: '报告错帐' popup
- myaccounts.ui: '充值' and '明细' popups

Ref: bricks-framework skill — PopupWindow dismiss_events pattern
2026-06-29 10:48:29 +08:00
d8cfd06c4c fix: 新增客户授信表单移除id字段,编辑时id通过URL query参数传递 2026-06-29 10:42:28 +08:00
Hermes Agent
503ae5434d fix: credit_limit.orgid存操作员orgid非客户orgid
- accountid已关联客户,orgid应为创建者(reseller)的orgid
- 修复credit_manage.ui查询0条记录问题
2026-06-24 17:41:27 +08:00
Hermes Agent
583babdd4a refactor: 移除手写CRUD dspy文件 - 改由build.sh自动生成
- 删除手写的add/update/delete_credit_limit.dspy
- json/credit_limit.json移除editable配置(使用默认CRUD API)
- 避免build.sh重新生成时覆盖手写代码
2026-06-24 12:36:54 +08:00
Hermes Agent
03bf5fcde0 fix: 修复datetime.now()错误 - dspy预加载datetime模块非datetime.datetime
- set_customer_credit.dspy: datetime.now() → datetime.datetime.now()
- add_credit_limit.dspy: 删除import, 用datetime.datetime.now()
- update_credit_limit.dspy: 删除import, 用datetime.datetime.now()
2026-06-24 12:07:19 +08:00
Hermes Agent
afb9dd5d88 fix: 修复授信表单提交 - 使用submit_url替代url, 移除手动buttons
- url → submit_url (Form正确的属性名)
- 移除手动buttons配置 (Form自动生成Submit/Reset工具栏)
- 移除method:POST (Form默认POST)
2026-06-24 11:36:00 +08:00
Hermes Agent
77624b1ef5 fix: 修正授信表单按钮bind target
- 保存按钮 submit target: self → credit_form
- 取消按钮 close target: self → PopupWindow
2026-06-24 10:56:04 +08:00
Hermes Agent
625c6b6873 fix: 修复新增客户授信表单submit无响应
- 添加 Form id: credit_form
- 保存按钮添加 submit binds
- 取消按钮添加 close binds
- Form 添加 submit 事件 bind 关闭弹窗
2026-06-24 10:42:52 +08:00
Hermes Agent
56ae61a992 fix: 授信表单改为客户名称查找模式 + 代客充值RBAC路径注册
1. 授信表单: accountid改为customer_name文本输入,后端先精确后模糊查找客户
2. 代客充值: load_path.py添加proxy_recharge.ui和proxy_recharge_submit.dspy路径
2026-06-22 17:26:03 +08:00
8a3f1955d3 fix: collation mismatch in SQL JOINs + billing date fields use uitype:date 2026-05-31 11:44:58 +08:00
78ff190789 feat(credit): redesign credit limit UI with dashboard, overview and management views
- Add hub.ui as main entry with stat cards (total/used/available/usage%)
- Add credit_overview.ui for user's own credit visualization with progress bars
- Add credit_manage.ui for distributor sales to manage customer credits
- Add set_credit_form.ui and set_customer_credit.dspy for credit adjustment
- Add credit_summary.dspy API for stats data
- Enhance creditlimit.py with get_credit_stats, get_my_credit_list, get_all_customer_credits
- Register new functions in init.py with ServerEnv
2026-05-30 21:00:27 +08:00
195a7bfb46 fix: wrap Tabular in VBox with cheight for proper scrolling 2026-05-29 22:09:45 +08:00
9696d4334b feat: 添加信用额度功能
- 新增 credit_limit 表定义和DDL
- 修改 accounting_config.py 支持信用额度透支检查
- 新增 creditlimit.py 信用额度管理模块
- 新增信用额度管理界面和CRUD API
- 支持设置/查询/更新客户信用额度
2026-05-28 19:09:04 +08:00