This commit is contained in:
gsinghpal
2026-03-24 18:08:48 -04:00
parent 92369be6e0
commit bd7275881f

View File

@@ -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):