-
Notifications
You must be signed in to change notification settings - Fork 1
ODOO-159: Refactor module structure by splitting core and enhanced fe… #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 19.0
Are you sure you want to change the base?
Conversation
…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
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
left a comment
There was a problem hiding this 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.
payment_multisafepay/__manifest__.py
Outdated
| "website": "https://github.com//multisafepay", | ||
| "license": "AGPL-3", | ||
| "category": "eCommerce", | ||
| "version": "19.0.1.1.0", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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..."); |
There was a problem hiding this comment.
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..."); |
There was a problem hiding this comment.
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!"); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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}") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 }} |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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..."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| console.log("MultiSafepay Form Processing..."); |
| @@ -0,0 +1,29 @@ | |||
| { | |||
| "name": "MultiSafepay Enhanced", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Module Restructure:
Core Module (payment_multisafepay):
Enhanced Module (payment_multisafepay_enhaced):
Technical Improvements:
This refactoring provides a cleaner architecture where: