Skip to content

Conversation

@zulquer
Copy link
Collaborator

@zulquer zulquer commented Nov 21, 2025

Module Restructure:

  • Renamed payment_multisafepay_official to payment_multisafepay (core module)
  • Created payment_multisafepay_enhaced module for business-specific features
  • Separated core payment functionality from enhanced custom features

Core Module (payment_multisafepay):

  • Refactored controllers/main.py for better maintainability
    • Split large _get_order method into smaller focused helper methods
    • Improved shopping cart line filtering using display_type blacklist
    • Fixed webhook validation error handling (_set_error with state_message)
  • Enhanced payment_method.py with amount-based filtering
    • Added minimum/maximum amount restrictions from MultiSafepay API
    • Implemented availability reporting for debugging
  • Improved payment_provider.py with better multi-company support
    • Added copy=False to multisafepay_api_key to prevent credential sharing
    • Enhanced SDK initialization and configuration management
  • Updated payment_transaction.py for Odoo 19 compatibility
    • Fixed method signatures for _set_done, _set_canceled, _set_error
    • Improved refund handling with better validation
  • Added comprehensive i18n support (de_DE, es_ES, fr_FR, it_IT, nl_BE, nl_NL)

Enhanced Module (payment_multisafepay_enhaced):

  • Moved business-specific logic to separate module
  • Implemented pricelist-based payment method filtering
    • Added _get_pricelist_from_context to retrieve pricelist from multiple sources
    • Support for e-commerce, backend orders, and website contexts
    • Automatic filtering based on allowed pricelists configuration
  • Enhanced payment transaction with custom refund reason tracking
  • Improved stock picking integration for order fulfillment
  • Enhanced account move integration for invoice management
  • Maintained all custom wizard and view functionality

Technical Improvements:

  • Better separation of concerns between core and custom features
  • Improved code organization and maintainability
  • Enhanced error handling and logging
  • Fixed Python method resolution order (MRO) for proper inheritance chain
  • Updated module dependencies and metadata

This refactoring provides a cleaner architecture where:

  1. Core MultiSafepay functionality remains in the base module
  2. Custom business logic lives in the enhanced module
  3. Both modules can be maintained and deployed independently

…atures

Major architectural improvements:

Module Restructure:
- Renamed payment_multisafepay_official to payment_multisafepay (core module)
- Created payment_multisafepay_enhaced module for business-specific features
- Separated core payment functionality from enhanced custom features

Core Module (payment_multisafepay):
- Refactored controllers/main.py for better maintainability
  * Split large _get_order method into smaller focused helper methods
  * Improved shopping cart line filtering using display_type blacklist
  * Fixed webhook validation error handling (_set_error with state_message)
- Enhanced payment_method.py with amount-based filtering
  * Added minimum/maximum amount restrictions from MultiSafepay API
  * Implemented availability reporting for debugging
- Improved payment_provider.py with better multi-company support
  * Added copy=False to multisafepay_api_key to prevent credential sharing
  * Enhanced SDK initialization and configuration management
- Updated payment_transaction.py for Odoo 19 compatibility
  * Fixed method signatures for _set_done, _set_canceled, _set_error
  * Improved refund handling with better validation
- Added comprehensive i18n support (de_DE, es_ES, fr_FR, it_IT, nl_BE, nl_NL)

Enhanced Module (payment_multisafepay_enhaced):
- Moved business-specific logic to separate module
- Implemented pricelist-based payment method filtering
  * Added _get_pricelist_from_context to retrieve pricelist from multiple sources
  * Support for e-commerce, backend orders, and website contexts
  * Automatic filtering based on allowed pricelists configuration
- Enhanced payment transaction with custom refund reason tracking
- Improved stock picking integration for order fulfillment
- Enhanced account move integration for invoice management
- Maintained all custom wizard and view functionality

Technical Improvements:
- Better separation of concerns between core and custom features
- Improved code organization and maintainability
- Enhanced error handling and logging
- Fixed Python method resolution order (MRO) for proper inheritance chain
- Updated module dependencies and metadata

This refactoring provides a cleaner architecture where:
1. Core MultiSafepay functionality remains in the base module
2. Custom business logic lives in the enhanced module
3. Both modules can be maintained and deployed independently
danielcivit and others added 5 commits November 25, 2025 16:54
Apply automatic code formatting and linting fixes from OCA pre-commit hooks.
This includes:
- Code style improvements (black, isort, prettier)
- Trailing whitespace removal
- End-of-file fixes
- Line length adjustments
- Import sorting and organization
- XML formatting improvements

All changes are purely cosmetic and do not affect functionality
danielcivit
danielcivit previously approved these changes Dec 10, 2025
Copy link
Member

@danielcivit danielcivit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works perfect. Very nice work. I left some comments - questions for your consideration, but the PR can be considered as approved.

"website": "https://github.com//multisafepay",
"license": "AGPL-3",
"category": "eCommerce",
"version": "19.0.1.1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version should be 19.0.2.0.0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about it, Because the name of the module is not the same as before. We should discuss about it.

"website": "https://github.com//multisafepay",
"license": "AGPL-3",
"category": "Accounting/Payment Providers",
"version": "19.0.1.1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new module. Version should be 19.0.1.0.0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. We should discuss this. Versions in this context are related to the modules. And modules are renamed completely. So i'm not sure about this. Maybe we should create git submodules.

<script type="text/javascript">
// Auto-submit form
document.addEventListener("DOMContentLoaded", function () {
console.log("Auto-submitting MultiSafepay form...");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was already there. For your consideration, let's remove this statement. Is not a good practice introduce this in production environment.

<template id="multisafepay_form" name="MultiSafepay Payment Form">
<!-- Basic debug -->
<script type="text/javascript">
console.log("MultiSafepay Form Processing...");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was already there. For your consideration, let's remove this statement. Is not a good practice introduce this in production environment.

if (form) {
form.submit();
} else {
console.error("Form not found!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was already there. For your consideration, let's remove this statement. I don't see the value in logging that message.

report, filtered_out, "amount", {"amount": amount}
)

# Note: Pricelist filtering moved to payment_multisafepay_enhaced module (custom feature)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of these notes? Why do we need it?

# Return all non-MultiSafepay methods plus filtered MultiSafepay methods
return other_methods + allowed_multisafepay_methods

# Note: _filter_by_pricelist() method moved to payment_multisafepay_enhaced module (custom feature)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of these notes? Why do we need it?

return other_methods + allowed_multisafepay_methods

# Note: _filter_by_pricelist() method moved to payment_multisafepay_enhaced module (custom feature)
# Note: _get_compatible_payment_methods_with_pricelist() method moved to payment_multisafepay_enhaced module (custom feature)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of these notes? Why do we need it?


reference = self.env["payment.transaction"]._compute_reference("multisafepay")

print(f"🔍 Generated reference: {reference}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove icon

),
)

# ⚠️ SALE MODULE INTEGRATION - Shipping Address
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove icon


- name: Build project
run: ./bin/release.sh ${{ env.VERSION }}
run: ./release.sh ${{ env.VERSION }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because, in this context, a folder at that level is considered an Odoo module, and 'bin' is not an Odoo module

"author": "MultiSafepay",
"website": "https://github.com//multisafepay",
"license": "AGPL-3",
"category": "Accounting/Payment Providers",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good to find our modules. eccomerce now is not the a dependency mandatory so... the category should be.. "Provider" ... I do not know. Could we discuss about it.

<template id="multisafepay_form" name="MultiSafepay Payment Form">
<!-- Basic debug -->
<script type="text/javascript">
console.log("MultiSafepay Form Processing...");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log("MultiSafepay Form Processing...");

@@ -0,0 +1,29 @@
{
"name": "MultiSafepay Enhanced",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants