feat(bx): 报销支付按未结清余额分次冲抵和发放。
冲抵后的余额不再自动记成发放,发放和冲抵分开提交,未结清单据继续留在待处理。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b49c99f1bd
commit
e7f942b399
8 files changed
+707
-261
No files matched your search
@@ -10,7 +10,9 @@ from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from app.core.bx_auth import BxUserContext
|
||||
from app.core.config import settings
|
||||
from app.models.bx_models import BxAdvanceApply, BxReimburseApply, BxReimburseOffset, BxWorkflowNode
|
||||
from app.models.bx_models import (
|
||||
BxAdvanceApply, BxReimburseApply, BxReimburseOffset, BxReimbursePayment, BxWorkflowNode,
|
||||
)
|
||||
from app.models.models import SysUser
|
||||
from app.models.pl_models import (
|
||||
PlFreightSettlement, PlFreightSettlementApproval, PlRemittanceVoucher,
|
||||
@@ -37,7 +39,7 @@ def db(monkeypatch):
|
||||
def begin(connection):
|
||||
connection.exec_driver_sql('BEGIN')
|
||||
for model in (SysUser, WechatNotice, BxAdvanceApply, BxReimburseApply,
|
||||
BxReimburseOffset, BxWorkflowNode, PlFreightSettlement,
|
||||
BxReimburseOffset, BxReimbursePayment, BxWorkflowNode, PlFreightSettlement,
|
||||
PlFreightSettlementApproval, PlRemittanceVoucher,
|
||||
PlVehicleRechargeApply, PlVehicleRechargeApproval, PlVehicleRechargeRecord):
|
||||
model.__table__.create(engine)
|
||||
@@ -184,6 +186,12 @@ def test_real_bx_complete_hook_retry_preserves_original_time_and_rolls_back(db,
|
||||
def test_batch_offset_only_notifies_real_payment_and_deduplicates_offsets(db, business):
|
||||
from app.services.bx.reimburse import ReimburseService
|
||||
row = seed(db, 'bx_reimburse', completed=False)
|
||||
db.add(BxAdvanceApply(
|
||||
id='advance', apply_code='ADV', applicant_id='applicant', applicant_name='申请人',
|
||||
reason='备用金', amount=100, status='issued', issue_status='issued', actual_amount=100,
|
||||
tenant_no='t1', create_dept_id='', create_time=NOW, update_time=NOW, del_flag=0,
|
||||
))
|
||||
db.commit()
|
||||
items = [{'advance_id': 'advance', 'offset_amount': 30}]
|
||||
ReimburseService.batch_offset(db, row.id, items, 70, business)
|
||||
assert db.query(WechatNotice).count() == 1
|
||||
|
||||
Reference in new issue
Block a user