Skip to content

Movements without accountable#25

Open
ldlsegovia wants to merge 2 commits intomasterfrom
movements-without-accountable
Open

Movements without accountable#25
ldlsegovia wants to merge 2 commits intomasterfrom
movements-without-accountable

Conversation

@ldlsegovia
Copy link
Collaborator

Tenía esta configuración:

Ledgerizer.setup do |conf|
  conf.tenant(:subsidiary, currency: :clp) do
    conf.asset :bank
    conf.liability :user_funds_custody

    conf.entry :user_deposit, document: :statement_line do
      conf.debit account: :bank, accountable: :reserve_account
      conf.credit account: :user_funds_custody, accountable: :subsidiary
    end
  end
end

con subsidiary como tenant y además accountable. Esto en la práctica no se puede hacer porque el modelo Subsidiary estaba incluyendo 2 concern: LedgerizerTenant y LedgerizerAccountable que implementan los métodos accounts y lines entonces, al incluir los dos, uno estaba sobrescribiendo los métodos del otro.

El cambio en este PR es la posibilidad de no poner un accountable

Ledgerizer.setup do |conf|
  conf.tenant(:subsidiary, currency: :clp) do
    conf.asset :bank
    conf.liability :user_funds_custody

    conf.entry :user_deposit, document: :statement_line do
      conf.debit account: :bank, accountable: :reserve_account
      conf.credit account: :user_funds_custody
    end
  end
end

que termina siendo equivalente a asignarle el tenant como accountable a un movimiento.


def find_or_create_account_from_executable_movement!(movement)
accounts.find_or_create_by!(
tenant: self,

Choose a reason for hiding this comment

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

👀

Copy link

@fdominguezclaro fdominguezclaro left a comment

Choose a reason for hiding this comment

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

LGTM

@ldlsegovia ldlsegovia merged commit ce68ae3 into master Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants