changes
This commit is contained in:
@@ -32,19 +32,19 @@ class AccountPaymentRegister(models.TransientModel):
|
|||||||
"""Check if the selected payment method requires card digits.
|
"""Check if the selected payment method requires card digits.
|
||||||
|
|
||||||
Uses the x_fc_requires_card_digits flag on payment method line.
|
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:
|
for wizard in self:
|
||||||
is_card = False
|
is_card = False
|
||||||
if wizard.payment_method_line_id:
|
if wizard.payment_method_line_id:
|
||||||
# First check the explicit flag
|
|
||||||
if hasattr(wizard.payment_method_line_id, 'x_fc_requires_card_digits'):
|
if hasattr(wizard.payment_method_line_id, 'x_fc_requires_card_digits'):
|
||||||
is_card = 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
|
elif wizard.payment_method_line_id.name:
|
||||||
if not is_card and wizard.payment_method_line_id.name:
|
|
||||||
method_name = wizard.payment_method_line_id.name.lower()
|
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
|
wizard.x_fc_is_card_payment = is_card
|
||||||
|
|
||||||
def action_create_payments(self):
|
def action_create_payments(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user