Skip to content

feat(core): v0.2 M1 material read-only copy (srm_material) - #14

Merged
marchtian merged 3 commits into
mainfrom
claude/project-thread-os80e5
Oct 23, 2026
Merged

marchtian merged 3 commits into
mainfrom
claude/project-thread-os80e5

Conversation

@marchtian

@marchtian marchtian commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by 田騏 · project thread

Closes #9(总览 #7)。

改了什么

  • 新对象 srm_material(设计 02 §4.1):erp_material_no(组织内唯一,导入匹配键)、material_code、name、specification、uom、category(lookup → srm_category)、active。字段名按设计文档用 erp_material_no(issue 正文写的是 erp_material_id,以 02 / ADR-0008 / 工程规范为准)。
  • 视图与导航:「全部物料」列表、「未关联品类」视图;工作台「基础数据」分组下加「物料」。品类详情页通过 lookup 自动显示下属物料。
  • 新权限集 srm_buyer(04 §2.2),挂在采购员和采购总监岗位上:物料只能改 category,其余字段 FLS 只读,不能新建、删除。srm_admin 负责导入与维护;srm_internal_base、srm_executive 加物料只读。
  • OWD 临时用 public_read_write,目标仍是 public_read:物料归执行导入的管理员所有,public_read 下采购员要改别人的记录只能给 modifyAllRecords,而平台的 modifyAllRecords 同时放开删除(测试实测)。已向平台提需求 Permission sets: no way to grant "edit any record" without also granting delete (modifyAllRecords implies allowDelete) objectstack#25470;平台支持「可改不可删」后改回 public_read。设计 02 §4.1 和对象源码注释都标明了这是临时做法。
  • 样例表格 data/samples/srm_material.csv(8 行虚构示例)和导入说明 data/samples/README.md:按 erp_material_no upsert;日常重复导入不带 category 列,避免覆盖采购员维护的关联。
  • 英文翻译补齐;设计 04 §2.2 的 srm_buyer、srm_admin 说明同步。

怎么验证的

新增 test/material.test.ts(进入 CI 的 pnpm test):

  • 样例表格经平台 POST /data/srm_material/import(upsert)导入两遍:第一遍新建 8 条,第二遍 0 新建,记录数与字段值完全一致;
  • 采购员设置的品类在再次导入后保留;
  • 采购员改品类成功,改名称 / 规格 / 启用被拒;不能新建、删除;
  • 重复的 erp_material_no 被唯一约束拒绝。

本地 pnpm validate、pnpm lint、pnpm typecheck、pnpm i18n:check(185/185)、pnpm test(33 通过)、pnpm build 全部通过。lint 唯一的提示是 v0.1 既有的审批流空审批人建议,与本 PR 无关。

🤖 Generated with Claude Code

https://claude.ai/code/session_01EGdBSEBg7Sy4QhBKoLqR1H

- New object srm_material: ERP material master copy keyed by
  erp_material_no (unique per organization), with list views, a
  "without category" view and a workbench nav entry.
- New permission set srm_buyer (on buyer and procurement director):
  edit only the category link; other fields read-only via FLS; no
  create/delete. srm_admin imports and maintains materials.
- OWD is public_read_write: under public_read a buyer needs
  modifyAllRecords to edit an imported row, which also grants delete.
- Sample sheet data/samples/srm_material.csv with an import guide;
  test/material.test.ts imports it twice through the platform import
  API and checks counts and values are unchanged.
- Design 02 §4.1 and 04 §2.2 updated to match; en translations added.

Closes #9

Claude-Session: https://claude.ai/code/session_01EGdBSEBg7Sy4QhBKoLqR1H
Co-authored-by: Claude <noreply@anthropic.com>
…bjectstack#25470

Claude-Session: https://claude.ai/code/session_01EGdBSEBg7Sy4QhBKoLqR1H
Co-authored-by: Claude <noreply@anthropic.com>
Mount srm_buyer on srm_buyer_lead as design 04 §2.1 says; snapshots now
include srm_material.

Claude-Session: https://claude.ai/code/session_01EGdBSEBg7Sy4QhBKoLqR1H
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.2 M1:物料只读副本 srm_material

2 participants