diff --git a/fusion_claims/wizard/account_payment_register.py b/fusion_claims/wizard/account_payment_register.py index d613751c..fcf29b3b 100644 --- a/fusion_claims/wizard/account_payment_register.py +++ b/fusion_claims/wizard/account_payment_register.py @@ -32,19 +32,19 @@ class AccountPaymentRegister(models.TransientModel): """Check if the selected payment method requires card digits. Uses the x_fc_requires_card_digits flag on payment method line. - Falls back to keyword matching if field not set. + Only falls back to keyword matching if the flag field does not + exist on the model (i.e. module not installed). """ - card_keywords = ['credit', 'debit', 'visa', 'mastercard', 'amex'] + card_keywords = ['credit', 'visa', 'mastercard', 'amex'] for wizard in self: is_card = False if wizard.payment_method_line_id: - # First check the explicit flag if hasattr(wizard.payment_method_line_id, 'x_fc_requires_card_digits'): is_card = wizard.payment_method_line_id.x_fc_requires_card_digits - # Fallback to keyword matching if flag not explicitly set - if not is_card and wizard.payment_method_line_id.name: + elif wizard.payment_method_line_id.name: method_name = wizard.payment_method_line_id.name.lower() - is_card = any(keyword in method_name for keyword in card_keywords) + is_card = any(kw in method_name for kw in card_keywords) + wizard.x_fc_is_card_payment = is_card wizard.x_fc_is_card_payment = is_card def action_create_payments(self):