fix: 协议子资源单事务保存,并补齐样本编码/OA/质检等近期能力
锁定缴费校验失败时整单回滚,避免样本半成功落库;前端禁止删除锁定缴费样本,改码走更正编码。同步落地样本更正、采集微信通知、OA提及未读、细胞产品套餐与相关迁移文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
19bc66ba45
commit
5dad1bb0e3
142 files changed
+95584
-65717
No files matched your search
@@ -283,6 +283,46 @@ def test_locked_sample_payment_cannot_be_omitted_from_protocol_save():
|
||||
assert db.get(BizProtocolPaymentSchedule, "schedule-1").del_flag == 0
|
||||
|
||||
|
||||
def test_save_sample_payments_commit_false_defers_commit(monkeypatch):
|
||||
"""commit=False 时成功路径不得自行 db.commit。"""
|
||||
db = _session()
|
||||
_payment(db)
|
||||
_schedule(db, status="open")
|
||||
_transfer(db, status="dfj")
|
||||
|
||||
commits: list = []
|
||||
real_commit = db.commit
|
||||
|
||||
def tracking_commit(*args, **kwargs):
|
||||
commits.append(1)
|
||||
return real_commit(*args, **kwargs)
|
||||
|
||||
monkeypatch.setattr(db, "commit", tracking_commit)
|
||||
|
||||
save_sample_payments_for_protocol(
|
||||
db,
|
||||
collection_protocol_id="protocol-1",
|
||||
tenant_no="tenant-a",
|
||||
user_id="u1",
|
||||
sample_payments=[
|
||||
{
|
||||
"id": "pay-1",
|
||||
"sampleCode": "S1",
|
||||
"payMode": "fq",
|
||||
"contractAmount": 100,
|
||||
"schedules": [
|
||||
{"scheduleNo": 1, "dueAmount": 100, "dueDate": "20261031"}
|
||||
],
|
||||
}
|
||||
],
|
||||
commit=False,
|
||||
)
|
||||
|
||||
assert commits == []
|
||||
db.expire_all()
|
||||
assert db.get(BizProtocolSamplePayment, "pay-1").update_by == "u1"
|
||||
|
||||
|
||||
def test_all_draft_structure_can_still_be_rebuilt():
|
||||
db = _session()
|
||||
_payment(db)
|
||||
|
||||
Reference in new issue
Block a user