Skip to content

erp5_accounting: allow setting default accounts when initializing lines

Titouan Soulard requested to merge tsoulard/erp5:for-mr-pig into master

While working on Bank Reconciliation, I had no way to know which accounts to use on Accounting Transaction Lines. One idea is to have a default account set in preferences for each of the possible account types, being set on Accounting Transaction Line depending on its id.

I then realized this could be quite useful even without Bank Reconciliation. For instance, when creating a Payment Transaction, if the settings are configured, one can have by default all three accounts already set, as in the following screenshot.

For now, I do not know if this is something we want, so I just open this MR to discuss, but the change is almost ready. We might want to add a simple test to check it works and does not break anything when unset. I also still have a few open issues:

  • should this preference be User or System? I chose User, but only losely thing it belongs here;
  • should this preference actually be global? I could imagine something Organization-wide only, but don't know where to put it. Maybe we can start the current way?
  • how to know if I should set source or destination account? Especially, is there any way to tell without using the Portal Type, which I currently do?

/cc @jerome

Merge request reports