Add Phase 13 internal accounting model
This commit is contained in:
@@ -10,6 +10,7 @@ from sqlalchemy import func, select
|
||||
|
||||
from app.modules.accounting.bank_models import AccountingBankTransaction
|
||||
from app.modules.accounting.ai_service import ai_assist_bank as run_ai_assist_bank, mark_review_outcome
|
||||
from app.modules.accounting.internal_model_service import predict_bank, record_prediction_review
|
||||
from app.modules.accounting.ledger_learning_service import (
|
||||
active_natures,
|
||||
available_tally_guids,
|
||||
@@ -249,6 +250,14 @@ def confirm_review(db, *, tx_id, tenant_id, client_id, nature_id, ledger_name, v
|
||||
final_ledger_name=tx.final_ledger_name,
|
||||
user_id=user_id,
|
||||
)
|
||||
record_prediction_review(
|
||||
db,
|
||||
tenant_id=tenant_id,
|
||||
source_type="bank",
|
||||
source_record_id=tx.id,
|
||||
final_nature_id=tx.final_nature_id,
|
||||
user_id=user_id,
|
||||
)
|
||||
return tx
|
||||
|
||||
|
||||
@@ -260,6 +269,14 @@ def ai_assist_transaction(db, *, tx_id, tenant_id, client_id, user_id):
|
||||
|
||||
|
||||
|
||||
def internal_model_predict_transaction(db, *, tx_id, tenant_id, client_id, force_shadow=True):
|
||||
tx = db.get(AccountingBankTransaction, int(tx_id))
|
||||
if not tx or int(tx.tenant_id) != int(tenant_id) or int(tx.client_id) != int(client_id):
|
||||
raise ValueError("Bank transaction was not found.")
|
||||
return predict_bank(db, row=tx, force_shadow=force_shadow)
|
||||
|
||||
|
||||
|
||||
def visible_workstations(db, tenant_id, branch_id=None):
|
||||
stmt = select(ERPWorkstationAgent).where(
|
||||
ERPWorkstationAgent.tenant_id == tenant_id,
|
||||
|
||||
Reference in New Issue
Block a user