More detailed analytic reporting

Rational

We have an analytic acocunt module which can be used to know the debits and creadits of the company for diferent analytic roots accounts. In case the company has several branches one can use the analytic accounts to track the benefit of each of the branches but it is not possible to see how each of the branches afected the Profit and Loss of the company and how much amount of an expense account is related to one for the branches.

Proposal

I think we should add a Many2One to an analytic account on the Profit & Loss context model (also another for analytic). When the users sets a value on this field the amount of the types will be computed using the analytic lines and filtered with the selected analytc account.

The analytic account should be also added to the general_ledger account so when opening a type to see it’s moves we will see the values of the analytic lines for each account.

Implementation

I guess by “Proft and Lost”, you mean “Income”

I would say that analytic accounts are useful when they collect new data. Here I think what you want it to add branch to general accounting to be able to filter by branch (like we filter by company).
But I can see that using analytic account for that is appealing because it does not require customization.

I do not think it is doable like that because it mainly require to replace completely the amount methods to be working on analytic lines instead of the general ledger account.

I do not think it makes sense to display general ledger account when browsing analytic values.

Instead I think we should see the other way. We do not add analytic to account reporting but we display analytic value using the tree structure of the types and accounts.
Instead I think analytic module should add a new Function field to compute amount per analytic account.
From the analytic chart, there is a tree_open to the account.account.type which display the new amount field and use as context the select analytic account. I think the computation must use all the child of the analytic account.
From this account type view, the user can open to a new model (maybe analytic ledger) which display per account the analytic value. And from there it is possible to open analytic lines.
I’m not sure all those models need the exact same feature as the GL part. I think it can be simpler. Also the account type may need to be duplicated using table_query in order to manage different actions (and rights).