fix(报价单): 后台/系统触发传递时补最小 ctx,避免 branch_required 静默失败
This commit is contained in:
@@ -47,11 +47,26 @@ export async function requestDeliveryReviewForSheet(input: {
|
||||
const branchCode =
|
||||
input.branchCode || getEffectiveBranchCode(input.ctx || null, input.operatingBranchCode || null);
|
||||
if (!branchCode) return { ok: false, code: 'branch_required', message: '请选择当前操作分公司' };
|
||||
// 后台/系统触发没有请求上下文 ⇒ 造一个只带分公司的最小 ctx(非超管 ⇒ getEffectiveBranchCode 直接用 ctx.branchCode)
|
||||
const ctx: TenantContext =
|
||||
input.ctx ??
|
||||
({
|
||||
userId: '',
|
||||
roles: [],
|
||||
permissions: ['customer_manage'],
|
||||
branchCode,
|
||||
supplierCode: null,
|
||||
purchaserCode: null,
|
||||
isSuperAdmin: false,
|
||||
isBranchAdmin: false,
|
||||
isInternalStaff: false,
|
||||
isSupplierAccount: false,
|
||||
} as TenantContext);
|
||||
try {
|
||||
const res = await submitPriceProposal({
|
||||
quoteSheetCode: input.quoteSheetCode,
|
||||
note: null,
|
||||
ctx: input.ctx ?? null,
|
||||
ctx,
|
||||
operatingBranchCode: input.operatingBranchCode ?? branchCode,
|
||||
requestedBy: input.requestedBy ?? null,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user