diff --git a/content/applications/finance/payment_providers.md b/content/applications/finance/payment_providers.md index 57e5902c6..82270d204 100644 --- a/content/applications/finance/payment_providers.md +++ b/content/applications/finance/payment_providers.md @@ -9,21 +9,21 @@ substitutions: ```{toctree} :titlesonly: true -payment-providers-wire-transfer -payment-providers-adyen -payment-providers-amazon-payment-services -payment-providers-asiapay -payment-providers-authorize -payment-providers-buckaroo -payment-providers-demo -payment-providers-flutterwave -payment-providers-mercado-pago -payment-providers-mollie -payment-providers-paypal -payment-providers-razorpay -payment-providers-stripe -payment-providers-worldline -payment-providers-xendit +payment_providers/wire_transfer +payment_providers/adyen +payment_providers/amazon_payment_services +payment_providers/asiapay +payment_providers/authorize +payment_providers/buckaroo +payment_providers/demo +payment_providers/flutterwave +payment_providers/mercado_pago +payment_providers/mollie +payment_providers/paypal +payment_providers/razorpay +payment_providers/stripe +payment_providers/worldline +payment_providers/xendit ``` Odoo embeds several **payment providers** that allow your customers to pay online, on their @@ -469,4 +469,3 @@ payments from other payments. - {doc}`../websites/ecommerce/checkout_payment_shipping/payments` - {doc}`accounting/bank` ::: - diff --git a/fix-link.py b/fix-link.py index 3d7d42cd4..441165017 100755 --- a/fix-link.py +++ b/fix-link.py @@ -30,12 +30,12 @@ if not os.path.isfile(input_file): changes_made = 0 # Process each line -with open(input_file, 'r') as f: +with open(input_file, "r") as f: for line in f: # Split line by ':' and trim whitespace - parts = [part.strip() for part in line.split(':', 4)] + parts = [part.strip() for part in line.split(":", 4)] if len(parts) < 5: - parts.extend([''] * (5 - len(parts))) # Ensure 5 parts + parts.extend([""] * (5 - len(parts))) # Ensure 5 parts file_path, line_err, status, desc, data = parts print(f"{GRAY}DEBUG: Processing line:{NC}") @@ -51,39 +51,44 @@ with open(input_file, 'r') as f: if desc == "undefined label": print(f"{GRAY}DEBUG: Found 'undefined label' case{NC}") - # Check if data is enclosed in < and > - if re.match(r'^<.*>$', data): - # Remove < and > for processing - clean_data = re.sub(r'^<|>$', '', data) - # Replace \, /, or _ with - in clean_data - new_data = clean_data.replace('\\', '-').replace('/', '-').replace('_', '-') - print(f"{GRAY}DEBUG: Changing '{data}' to '<{new_data}>'{NC}") - # Check if the data appears in an {image} directive - with open(file_path, 'r') as file_content: - lines = file_content.readlines() - skip = False - for i, line_content in enumerate(lines): - if data in line_content and i > 0 and '{image}' in lines[i-1]: - skip = True - break - - if skip: - print(f"{GRAY}DEBUG: Skipping '{data}' as it appears in an {{image}} directive{NC}") - else: - # Replace the old data with new data in the file - try: - with fileinput.FileInput(file_path, inplace=True) as file: - for line_content in file: - if '{image}' not in line_content: - line_content = line_content.replace(data, f"<{new_data}>") - print(line_content, end='') - changes_made += 1 - print(f"{GREEN}Processed: {file_path} - Changed '{data}' to '<{new_data}>'{NC}") - except Exception as e: - print(f"{RED}WARNING: Failed to modify {file_path} - {str(e)}{NC}") + # Remove < and > for processing + clean_data = f"<{data}>" + # Replace \, /, or _ with - in clean_data + new_data = ( + clean_data.replace("\\", "-").replace("/", "-").replace("_", "-") + ) + print(f"{GRAY}DEBUG: Changing '{data}' to '{new_data}'{NC}") + # Check if the data appears in an {image} directive + with open(file_path, "r") as file_content: + lines = file_content.readlines() + skip = False + for i, line_content in enumerate(lines): + if data in line_content and i > 0 and "{image}" in lines[i - 1]: + skip = True + break + if skip: + print( + f"{GRAY}DEBUG: Skipping '{data}' as it appears in an {{image}} directive{NC}" + ) else: - print(f"{GRAY}DEBUG: Skipping '{data}' as it is not enclosed in <> {NC}") + # Replace the old data with new data in the file + try: + with fileinput.FileInput(file_path, inplace=True) as file: + for line_content in file: + if "{image}" not in line_content: + line_content = line_content.replace( + f'<{data}>', f"{new_data}" + ) + print(line_content, end="") + changes_made += 1 + print( + f"{GREEN}Processed: {file_path} - Changed '{data}' to '{new_data}'{NC}" + ) + except Exception as e: + print( + f"{RED}WARNING: Failed to modify {file_path} - {str(e)}{NC}" + ) elif "toctree contains reference to nonexisting document" in desc: print(f"{GRAY}DEBUG: Found 'toctree' case{NC}") @@ -92,76 +97,110 @@ with open(input_file, 'r') as f: if doc_ref_match: doc_ref = doc_ref_match.group(1) # Replace \, /, or _ with - in doc_ref - new_data = doc_ref.replace('\\', '-').replace('/', '-').replace('_', '-') + new_data = ( + doc_ref.replace("\\", "-").replace("/", "-").replace("_", "-") + ) print(f"{GRAY}DEBUG: Changing '{doc_ref}' to '{new_data}'{NC}") # Check if the doc_ref appears in an {image} directive - with open(file_path, 'r') as file_content: + with open(file_path, "r") as file_content: lines = file_content.readlines() skip = False for i, line_content in enumerate(lines): - if doc_ref in line_content and i > 0 and '{image}' in lines[i-1]: + if ( + doc_ref in line_content + and i > 0 + and "{image}" in lines[i - 1] + ): skip = True break if skip: - print(f"{GRAY}DEBUG: Skipping '{doc_ref}' as it appears in an {{image}} directive{NC}") + print( + f"{GRAY}DEBUG: Skipping '{doc_ref}' as it appears in an {{image}} directive{NC}" + ) else: # Replace the old data with new data in the file try: with fileinput.FileInput(file_path, inplace=True) as file: for line_content in file: - if '{image}' not in line_content: - line_content = line_content.replace(doc_ref, new_data) - print(line_content, end='') + if "{image}" not in line_content: + line_content = line_content.replace( + doc_ref, new_data + ) + print(line_content, end="") changes_made += 1 - print(f"{GREEN}Processed: {file_path} - Changed '{doc_ref}' to '{new_data}'{NC}") + print( + f"{GREEN}Processed: {file_path} - Changed '{doc_ref}' to '{new_data}'{NC}" + ) except Exception as e: - print(f"{RED}WARNING: Failed to modify {file_path} - {str(e)}{NC}") + print( + f"{RED}WARNING: Failed to modify {file_path} - {str(e)}{NC}" + ) else: - print(f"{RED}WARNING: Could not extract document reference from '{data}' in {file_path}{NC}") + print( + f"{RED}WARNING: Could not extract document reference from '{data}' in {file_path}{NC}" + ) elif "card directive targets nonexisting document" in desc: print(f"{GRAY}DEBUG: Found 'card directive' case{NC}") # Extract the document reference from desc (since data might be empty), remove .rst doc_ref_match = re.search(r"'([^']*)'", desc) if doc_ref_match: - doc_ref = doc_ref_match.group(1).replace('.rst', '') + doc_ref = doc_ref_match.group(1).replace(".rst", "") # Replace \, /, or _ with - in doc_ref - new_data = doc_ref.replace('\\', '-').replace('/', '-').replace('_', '-') + new_data = ( + doc_ref.replace("\\", "-").replace("/", "-").replace("_", "-") + ) print(f"{GRAY}DEBUG: Changing '{doc_ref}' to '{new_data}'{NC}") # Check if the doc_ref appears in an {image} directive - with open(file_path, 'r') as file_content: + with open(file_path, "r") as file_content: lines = file_content.readlines() skip = False for i, line_content in enumerate(lines): - if doc_ref in line_content and i > 0 and '{image}' in lines[i-1]: + if ( + doc_ref in line_content + and i > 0 + and "{image}" in lines[i - 1] + ): skip = True break if skip: - print(f"{GRAY}DEBUG: Skipping '{doc_ref}' as it appears in an {{image}} directive{NC}") + print( + f"{GRAY}DEBUG: Skipping '{doc_ref}' as it appears in an {{image}} directive{NC}" + ) else: # Replace the old data with new data in the file try: with fileinput.FileInput(file_path, inplace=True) as file: for line_content in file: - if '{image}' not in line_content: - line_content = line_content.replace(doc_ref, new_data) - print(line_content, end='') + if "{image}" not in line_content: + line_content = line_content.replace( + doc_ref, new_data + ) + print(line_content, end="") changes_made += 1 - print(f"{GREEN}Processed: {file_path} - Changed '{doc_ref}' to '{new_data}'{NC}") + print( + f"{GREEN}Processed: {file_path} - Changed '{doc_ref}' to '{new_data}'{NC}" + ) except Exception as e: - print(f"{RED}WARNING: Failed to modify {file_path} - {str(e)}{NC}") + print( + f"{RED}WARNING: Failed to modify {file_path} - {str(e)}{NC}" + ) else: - print(f"{RED}WARNING: Could not extract document reference from '{desc}' in {file_path}{NC}") + print( + f"{RED}WARNING: Could not extract document reference from '{desc}' in {file_path}{NC}" + ) else: - print(f"{GRAY}DEBUG: Description '{desc}' doesn't match any conditions{NC}") + print( + f"{GRAY}DEBUG: Description '{desc}' doesn't match any conditions{NC}" + ) else: print(f"{RED}WARNING: File not found: {file_path}{NC}") print(f"{GRAY}DEBUG: ---{NC}") print(f"{GREEN}Processing completed!{NC}") -print(f"{GREEN}Total changes made: {changes_made}{NC}") \ No newline at end of file +print(f"{GREEN}Total changes made: {changes_made}{NC}")