Skip to content

Refactor account_loan & Introduce account_leasing #2233

Description

@petrus-v

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementstalePR/Issue without recent activity, it'll be soon closed automatically.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions