From d401922a6c260a38a777b94b6f4ecf40744d8bef Mon Sep 17 00:00:00 2001 From: Doug Lovett Date: Tue, 12 Mar 2024 13:51:12 -0700 Subject: [PATCH] Update amendment reports debtor former name logic. Signed-off-by: Doug Lovett --- ppr-api/src/ppr_api/models/registration.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ppr-api/src/ppr_api/models/registration.py b/ppr-api/src/ppr_api/models/registration.py index 21fb780bf..dc659f506 100644 --- a/ppr-api/src/ppr_api/models/registration.py +++ b/ppr-api/src/ppr_api/models/registration.py @@ -920,7 +920,9 @@ def get_former_party_name(self, new_party: Party): address1 = party.client_code.address if address2 is None and new_party.client_code: address2 = new_party.client_code.address - if address1 and address2 and address1.json != address2.json: + if address1 and address2 and address1.json != address2.json and \ + (not new_party.previous_party_id or + (new_party.previous_party_id and new_party.previous_party_id == party.id)): return former_name # Could only be changing a birthdate (names are identical). if new_party.previous_party_id and new_party.previous_party_id == party.id: @@ -934,9 +936,11 @@ def get_former_party_name(self, new_party: Party): former_name = self.__get_matching_party_name(new_party, party) return former_name if address1 and address2 and address1.json == address2.json: - if party.client_code and party.client_code.name: + if party.client_code and party.client_code.name and new_party.business_name and \ + new_party.business_name != party.client_code.name: former_name = party.client_code.name - elif party.business_name: + elif party.business_name and new_party.business_name and \ + new_party.business_name != party.business_name: former_name = party.business_name else: # match if only 1 name is different in addition to same address.