109 Commits

Author SHA1 Message Date
85ae9802a2 fix: add agreement_id/contract_id to editexclouded in items CRUD
Fields auto-set from parent context, no need for user input.
2026-07-12 10:39:21 +08:00
2f2c9c42e7 fix: remove cheight from items_list CRUD index.ui 2026-07-12 10:36:58 +08:00
b69bd38b27 fix: toolbar buttons open CRUD page directly, remove ensure dspy layer
Suppliers '供销协议' → /supplychain/supply_contracts_list?supplier_id=
Sub-distributors '分销协议' → /supplychain/distribution_agreements_list?sub_reseller_id=

No more DataViewer/HTML-redirect popup issues.
2026-07-12 10:32:45 +08:00
1e7f713725 fix: use HTML meta refresh redirect instead of DataViewer or 302
PopupWindow renders dspy response directly. DataViewer doesn't
work inside popup context. HTML meta refresh redirects to CRUD page.
2026-07-12 10:28:24 +08:00
a930847317 fix: ensure dspy returns 302 redirect instead of DataViewer widget
PopupWindow can't render DataViewer returned from dspy.
Now dspy creates contract/agreement if needed, then 302→CRUD page.
2026-07-12 10:27:27 +08:00
a3176e4f34 fix: use absolute /supplychain/ URLs in JSON CRUD source configs
Same as index.ui fix — entire_url() relative paths lose module prefix.
Now both generated files AND source configs use absolute paths.
2026-07-12 10:19:30 +08:00
7f2c265764 fix: use absolute /supplychain/ URLs in all CRUD-generated index.ui
entire_url() relative paths resolve without module prefix
in bricks DataViewer context. Changed all to /supplychain/... paths.
2026-07-12 10:18:25 +08:00
3159afbede fix: get_search_prodtypeid/productid query correct DB (sage) and tables
- prodtypeid: product_types→product_category, supplychain→sage
- productid: products→product, supplychain→sage
2026-07-12 09:37:38 +08:00
0049db58e5 fix: move product_org_auth sync to distribution_agreement_items (not supply_contract_items)
- supply_contract_items: revert — products already belong to reseller's own org
- distribution_agreement_items: create → insert product_org_auth for sub_reseller
- distribution_agreement_items: delete → remove product_org_auth
- org_id in product_org_auth = sub_reseller_id (二级分销商)
2026-07-10 15:48:27 +08:00
3c98e8a991 feat: sync product_org_auth on supply_contract_items create/delete 2026-07-10 15:38:28 +08:00
49d59c3ed0 fix: auto-set managed_by to current user when creating sub_distributor 2026-07-10 14:14:09 +08:00
fac526637b fix: add id to userrole insert + remove manual created_at (DB has defaults) 2026-07-10 14:01:05 +08:00
fb579cbd2f fix: use sor.R for role lookup + proper datetime format
- Changed raw SQL role query to sor.R('role', {'role': name})
- Fixed timestampstr() → datetime format to avoid data truncation
- Added logined + reseller.operator roles alongside admin
2026-07-10 13:52:14 +08:00
ed4898bf90 fix: use absolute /supplychain/ paths in ensure dspy DataViewer URLs
Relative ../ paths inside PopupWindow DataViewer resolve without
module prefix. Use absolute /supplychain/ paths instead.
2026-07-10 13:51:06 +08:00
916b501c67 feat: add admin + reset admin password toolbar for sub_distributors
- api/add_sub_distributor_admin.dspy: create org+user+reseller.admin role, show password
- api/reset_sub_distributor_admin_pwd.dspy: reset admin password, show new password
- sub_distributors_list: add toolbar buttons with popup binds
2026-07-10 12:15:31 +08:00
efe45215f0 fix: add /supplychain/ prefix to entire_url in index.ui and menu.ui
entire_url() without module prefix resolves to wrong path,
causing 403 on RBAC check. Now uses absolute /supplychain/ paths.
2026-07-10 11:59:08 +08:00
749047814f fix: use DataViewer instead of UrlWidget (UrlWidget ignores w/h; DataViewer works) 2026-07-10 11:30:05 +08:00
e0dc9963b7 feat: sub_distributors_create now creates organization + supply relation 2026-07-10 11:16:30 +08:00
0c718cf461 fix: fix column name + ensure dspy now returns CRUD page after create
- sub_resellers column is sub_reseller_name (not sub_dist_name)
- After ensure, return UrlWidget loading CRUD list filtered by id
- Popup size increased for CRUD page viewing
2026-07-10 11:11:21 +08:00
7fa70b9a24 fix: use urlwidget+PopupWindow instead of script/dspy for toolbar binds
bricks.js only supports 5 actiontypes; dspy and script with fetch
are not available. Use urlwidget with PopupWindow target instead.
2026-07-10 11:03:56 +08:00
8d9f31d7ad fix: change toolbar binds from dspy to script actiontype 2026-07-10 10:58:22 +08:00
0129866c00 fix: use existing SVG icons for toolbar buttons 2026-07-10 10:38:43 +08:00
3a36dc2400 feat: one-click ensure contract/agreement from supplier/distributor list
- api/ensure_distribution_agreement.dspy: check/create distribution_agreement for sub_reseller
- api/ensure_supply_contract.dspy: check/create supply_contract for supplier
- sub_distributors_list: toolbar '分销协议' now calls ensure endpoint (was PopupWindow)
- suppliers_list: add toolbar '供销协议' calling ensure endpoint
2026-07-10 10:37:17 +08:00
ccd1a6f0e8 fix: remove cheight from all CRUD index.ui — let bricks Tabular auto-height
Removed cheight:40 from outer VBox and inner Tabular options in:
- suppliers_list
- sub_resellers_list
- sub_distributors_list
- supply_contracts_list
- distribution_agreements_list

CRUD Tabular handles its own height; hardcoding cheight causes
title row to fill entire viewport.
2026-07-10 09:29:40 +08:00
6314b98c76 fix: add missing code fields to editexclouded in CRUD index.ui
- supply_contracts_list: add supplier_id to editexclouded
- distribution_agreements_list: add sub_reseller_id to editexclouded
- distribution_agreements_list: fix editable URLs to use custom API dspy paths
- distribution_agreements_list JSON: remove sub_reseller_id query param from new_data_url

Root cause: xls2ui strips code-type fields (those in browserfields.alters with
uitype=code and dataurl) from the generated editexclouded list, even though
they're in the source CRUD JSON config. This causes bricks.js to render UiCode
widgets in add/edit forms that try to call .length on undefined options data,
producing: TypeError: Cannot read properties of undefined (reading 'length')

Force-added generated files (normally gitignored) as temporary fix until
xls2ui is corrected.
2026-07-10 09:15:13 +08:00
aae4271668 fix: align create_sub_reseller with sub_distributors model — sub_dist_name, no code field 2026-07-09 16:55:07 +08:00
880e9e59c4 fix: use datetime.now instead of ServerEnv in _generate_sub_reseller_code 2026-07-09 16:53:49 +08:00
06f809fc32 fix: use request._run_ns instead of ServerEnv() in create_sub_reseller 2026-07-09 16:39:07 +08:00
da5fd85984 fix: add_sub_distributors calls create_sub_reseller for org+account creation 2026-07-09 16:29:11 +08:00
160bc36fb1 fix: remove unused sub_dist_code field 2026-07-09 16:24:48 +08:00
3f46b93b65 fix: sub_dist_code auto-generated with getID() 2026-07-09 16:18:37 +08:00
d7d53d2e3b fix: remove unique idx_sd_code — one distributor can have multiple sub-distributors 2026-07-09 16:17:14 +08:00
e836991c23 fix: add CURRENT_TIMESTAMP defaults to created_at/updated_at 2026-07-09 15:04:44 +08:00
48658403a3 fix: add default to sub_dist_code and created_by 2026-07-09 14:57:09 +08:00
2a3eb72d2b fix: remove duplicate status code entry in suppliers model 2026-07-09 14:38:38 +08:00
6c926cf3d5 fix: add status codes to models — prevents empty code field in search_form 2026-07-09 14:07:17 +08:00
5705e674b5 feat: add orgid to sub_resellers + get_distribution_chain
- create_sub_reseller auto-creates organization record with orgid
- get_distribution_chain walks from product_owner down to seller via sub_resellers
2026-07-07 12:20:39 +08:00
7c0acb5245 fix: UiFile-based upload with drag-drop support, download/delete toolbar 2026-07-03 17:57:48 +08:00
07d5173d75 feat: add download and delete actions to contract attachment list 2026-07-03 17:45:57 +08:00
3017ac295b fix: bricks.app.getWidgetById → bricks.getWidgetById (app is not the root for widget lookup) 2026-07-03 17:42:03 +08:00
82579b14ad fix: override file_uploaded to return FileMgrResult — base returns None causing NoneType.status 2026-07-03 17:37:06 +08:00
0203dc1c24 fix: quota 0→1000000000 (unlimited) for contract attachments 2026-07-03 17:33:31 +08:00
587cabeb1e fix: ContractAttachMgr 覆盖 owner/quota 校验
is_folder_ownerid: 直接返回 True (合同附件不校验owner)
get_organization_quota: 无限制配额
2026-07-03 17:18:03 +08:00
b375ba5155 chore: remove vim swap file 2026-07-03 17:05:35 +08:00
a914380a9b feat: ContractAttachMgr — supplychain 自有附件管理器
ContractAttachMgr 继承 FileMgr, fiid 从 params_kw 透传
contract_upload.dspy: 自有上传端点
contract_attach.ui: 改用 supplychain 自己的上传 dspy
2026-07-03 17:05:24 +08:00
64e240872f fix: show_error → console.error (bricks 无此方法) 2026-07-03 16:54:26 +08:00
b4d66933a6 fix: get_files() -> this.value (UiFile 正确取值方式) 2026-07-03 16:51:51 +08:00
3497d946ce fix: Jinja2 转义 — upload_url 用 {% set %} 预计算
entire_url("/filemgr/...") 中的 " 导致 Jinja2 解析报错
改用 {% set upload_url = entire_url('/filemgr/upload_file.dspy') %}
2026-07-03 16:48:24 +08:00
a63b6ce427 fix: 附件上传改用 UiFile changed + fetch FormData
UiFile changed 事件 → script fetch POST multipart → 成功后 render Tabular
无需点击上传按钮,选择文件即自动上传
2026-07-03 16:46:14 +08:00
5968b3a527 feat: 注册 contract_attach RBAC 权限 2026-07-03 16:40:11 +08:00