Context
Currently, the account_loan module handles both standard financial loans and leasing contracts via a boolean field is_leasing. This approach limits flexibility and mixes different concepts (e.g., miscellaneous journal entries vs. vendor bills).
Additionally, we need to introduce support for the Purchase Option (buyout) at the end of leasing contracts.
Objective
Clearly separate the generic loan management from leasing specifics and enrich the leasing functionalities.
1. Refactor account_loan (Base)
This module will focus on the generic management of loan contracts, primarily for financial loans.
- New
loan_type field: Replace the is_leasing boolean with a loan_type Selection field.
- Initial values:
loan (Loan given), borrow (Loan received).
- The type will determine the default accounting behavior (e.g., Journal types).
- The field should be editable in draft state and become read-only once the loan is posted or lines are generated.
- Cleanup: Extract the logic specific to vendor bill generation (currently triggered by is_leasing to move it into the new module.
2. New module account_leasing
This module will depend on account_loan and extend it for leasing contracts.
- Extend
loan_type: Add the leasing value to the selection.
- Leasing Logic:
- Implement logic to generate Vendor Bills or miscellaneous operation entries.
Note: This behavior should be configurable.
- Purchase Option Management:
- Add configuration on the contract to define the account used for the purchase option.
- Add a flag on the loan line to identify the "Purchase Option" exercise.
- Provide a wizard or mechanism to easily "exercise" this option and generate the corresponding final entry/invoice.
3. Migration
- provide script to migrate from 18 to 19 easly
Context
Currently, the
account_loanmodule handles both standard financial loans and leasing contracts via a boolean fieldis_leasing. This approach limits flexibility and mixes different concepts (e.g., miscellaneous journal entries vs. vendor bills).Additionally, we need to introduce support for the Purchase Option (buyout) at the end of leasing contracts.
Objective
Clearly separate the generic loan management from leasing specifics and enrich the leasing functionalities.
1. Refactor account_loan (Base)
This module will focus on the generic management of loan contracts, primarily for financial loans.
loan_typefield: Replace theis_leasingboolean with aloan_typeSelection field.loan(Loan given),borrow(Loan received).2. New module
account_leasingThis module will depend on account_loan and extend it for leasing contracts.
loan_type: Add theleasingvalue to the selection.Note: This behavior should be configurable.
3. Migration