fix: 修复真实验收中的企业范围与草稿复制问题

显式企业身份核验只访问指定企业,避免回退到全量查询。
复制只清空源单存在的发票与附件字段,避免通用模板拒绝未知属性。
补充隔离回归与指定测试企业验收记录,测试数据已清理。

验证:929 项测试通过,类型检查及版本一致性检查通过。
This commit is contained in:
gitea committed 2026-10-29 22:04:36 +08:00
1 parent 6249feee23
commit 613fe3476c
8 files changed
+108 -14

No files matched your search

+11
View File
@@ -61,6 +61,17 @@ function fixture(options: {
}
describe("bill API write contracts", () => {
test("复制通用模板不注入源单没有的发票或租户自定义字段", async () => {
const { client, writes } = fixture();
await copyBillAsDraft(client, "corp", "f", { keepAttachments: false });
expect(writes).toHaveLength(1);
expect(writes[0].json.form).not.toHaveProperty("u_发票总金额");
expect(writes[0].json.form.details[0].feeTypeForm).not.toHaveProperty("u_发票总金额");
expect(writes[0].json.form.details[0].feeTypeForm).not.toHaveProperty("invoice");
expect(writes[0].json.form.details[0].feeTypeForm).not.toHaveProperty("invoiceForm");
expect(writes[0].json.form).not.toHaveProperty("attachments");
expect(writes[0].json.form.details[0].feeTypeForm).not.toHaveProperty("attachments");
});
test("创建和预演均拒绝缺失明细规格、必填明细与过长表头,不发起创建", async () => {
for (const options of [{ missingDetailSpec: true }, { detailRequired: "u_项目" }, { titleMaxLength: 1 }]) {
const { client, writes } = fixture(options);