Skip to content

Commit

Permalink
智能识票报错 #194
Browse files Browse the repository at this point in the history
  • Loading branch information
ysc1234 committed Mar 5, 2024
1 parent 8dc23dc commit fa6061f
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ isEnabled: true
handler: |-
// 创建记录时,不填写”报销“或“应付合同”字段,状态默认为“未关联记录”;
// 创建记录时,填写”报销“或“应付合同”字段,状态默认为“未提交审批”;
const { doc, previousDoc } = ctx.params;
const { doc, previousDoc, isInsert,isUpdate } = ctx.params;
const invoicesObj = this.getObject('invoices');
// 新增发票
if (!doc.state) {
Expand All @@ -20,12 +20,15 @@ handler: |-
state: "unassociated"
})
}
} else if (doc.state == "unassociated"){
if ((!previousDoc.purchase_order && doc.purchase_order) || (!previousDoc.expense_reports && doc.expense_reports)) {
// 修改发票
await invoicesObj.directUpdate(doc._id, {
state: "unsubmitted"
})
} else if (doc.state == "unassociated") {
if (isUpdate) {
if ((!previousDoc.purchase_order && doc.purchase_order) || (!previousDoc.expense_reports && doc.expense_reports)) {
// 修改发票
await invoicesObj.directUpdate(doc._id, {
state: "unsubmitted"
})
}
}
}
locked: false

0 comments on commit fa6061f

Please sign in to comment.