From 9edd49d152edab74fe84223d286b4a2b2c35e565 Mon Sep 17 00:00:00 2001 From: EasonPan Date: Fri, 20 Dec 2024 09:36:01 -0800 Subject: [PATCH] 24952 - Fix not allow to update NoW draft issue (#3139) * update logic to allow update NoW draft --- legal-api/src/legal_api/services/authz.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/legal-api/src/legal_api/services/authz.py b/legal-api/src/legal_api/services/authz.py index 087236e898..0980e23598 100644 --- a/legal-api/src/legal_api/services/authz.py +++ b/legal-api/src/legal_api/services/authz.py @@ -504,7 +504,7 @@ def is_allowed(business: Business, else: is_ignore_draft_blockers = True - # Special case: handiling authorization for amalgamation application + # Special case: handling authorization for amalgamation application # this check is to make sure that amalgamation application is not allowed/authorized with continue in corps if filing_type == 'amalgamationApplication' and legal_type in ['C', 'CBEN', 'CUL', 'CCC']: return False @@ -746,7 +746,7 @@ def business_blocker_check(business: Business, is_ignore_draft_blockers: bool = if business.in_dissolution: business_blocker_checks[BusinessBlocker.IN_DISSOLUTION] = True - if has_notice_of_withdrawal_filing_blocker(business): + if has_notice_of_withdrawal_filing_blocker(business, is_ignore_draft_blockers): business_blocker_checks[BusinessBlocker.FILING_WITHDRAWAL] = True return business_blocker_checks @@ -872,15 +872,16 @@ def has_blocker_warning_filing(warnings: List, blocker_checks: dict): return warning_matches -def has_notice_of_withdrawal_filing_blocker(business: Business): +def has_notice_of_withdrawal_filing_blocker(business: Business, is_ignore_draft_blockers: bool = False): """Check if there are any blockers specific to Notice of Withdrawal.""" if business.admin_freeze: return True - filing_statuses = [Filing.Status.DRAFT.value, - Filing.Status.PENDING.value, + filing_statuses = [Filing.Status.PENDING.value, Filing.Status.PENDING_CORRECTION.value, Filing.Status.ERROR.value] + if not is_ignore_draft_blockers: + filing_statuses.append(Filing.Status.DRAFT.value) blocker_filing_matches = Filing.get_filings_by_status(business.id, filing_statuses) if any(blocker_filing_matches): return True