Issue 11057

Title
Equity accounts with childs not storing deferral credit/debit amount
Priority
bug
Status
testing
Nosy list
acaubet, ced, pokoli, reviewbot
Assigned to
ced
Keywords
backport, review

Created on 2021-12-15.12:22:35 by acaubet, last changed 7 days ago by reviewbot.

Files

File name Uploaded Type Details
scenario_close_fiscalyear.rst acaubet, 2021-12-15.12:22:35 text/x-rst view

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-15.23:47:00

I updated the review376391002 to show that we could compute the cumulate in the get_balance of Deferral.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-04.18:44:32
On 2022-01-04 18:10, Sergi Almacellas Abellana wrote:
> > I still do not uderstand why the code can not be placed in get_balance.
> > 
> Then we do not understand each other. 
> 
> On my first attempt I tried to follow your advice and make the get_balance sum the children accounts, but this does not fix the issue because it does not exist any deferral record related to the parent account, so the cumulate function does not find it so the children sum in get_balance is useless.

I do not understand why you can do it in your review and not in
get_balance. It is exactly the same code.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2022-01-04.18:10:49

I still do not uderstand why the code can not be placed in get_balance.

Then we do not understand each other.

On my first attempt I tried to follow your advice and make the get_balance sum the children accounts, but this does not fix the issue because it does not exist any deferral record related to the parent account, so the cumulate function does not find it so the children sum in get_balance is useless.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-04.18:07:13
On 2022-01-04 18:05, Sergi Almacellas Abellana wrote:
> > I do not understand why it can not be done in the Deferral.get_balance.
> 
> Because we [do not create a deferral record for accounts that do not have any type](https://hg.tryton.org/modules/account/file/5a15561b28ce/fiscalyear.py#l245). So the search of the deferral records fails for parent accounts.
>
> > Indeed the same code could be written in this function if it is changed
> into a classmethod.
> 
> This requires to have a deferral record for all accounts which is not the case.

I still do not uderstand why the code can not be placed in get_balance.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2022-01-04.18:05:13

I do not understand why it can not be done in the Deferral.get_balance.

Because we do not create a deferral record for accounts that do not have any type. So the search of the deferral records fails for parent accounts.

Indeed the same code could be written in this function if it is changed
into a classmethod.

This requires to have a deferral record for all accounts which is not the case.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-04.17:45:43
On 2022-01-04 11:58, Sergi Almacellas Abellana wrote:
> It is not possible to do it on the deferral computation as the parent accounts does not have any deferral record, but we can include the children account values on the `_cumulate` function for balance.

I do not understand why it can not be done in the Deferral.get_balance.
Indeed the same code could be written in this function if it is changed
into a classmethod.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2022-01-04.11:58:31

Here is review376391002 which cumulates the children amounts on balance.
It is not possible to do it on the deferral computation as the parent accounts does not have any deferral record, but we can include the children account values on the _cumulate function for balance.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-04.01:05:07

For me it is the wrong solution msg72549 because the deferrals are also used to compute debit and credit which are not summing children.
Indeed I think the proper solution is that get_balance of Account Deferral should sum the children.

Author: [hidden] (acaubet)
Date: 2021-12-15.14:12:58

For the record, on newsletter or where you consider we should warn to reopen and close the fiscal years to recompute.

Author: [hidden] (acaubet)
Date: 2021-12-15.13:49:23

Don't know since this happens, but at least we found on 6.0 and following so it should be backported.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-12-15.12:37:42

The issue comes from the credit/debit computation which does not compute values for parent accounts. The computation is done on the balance (thanks to parent left/right).

To have a proper computation we need to store such values, so I guess we can add a context flag to enable computation also for parents records and activate it on the BalanceNonDeferral computation.

Author: [hidden] (acaubet)
Date: 2021-12-15.12:22:35

If a equity account (A) have sub-accounts/childs (A.1) on closing the fiscal year it doesn't store the debit/credit of A, causing wrong computation of the balance.
I don't know if maybe it's normal that A is not saved instead balance of A should return the childs sum.
The steps could be reproduced by the attached scenario.
I'm starting to check where the problem could be.
Any help is appreciated as account module and accounting in general could be complex.

History
Date User Action Args
2022-01-15 23:49:28reviewbotsetmessages: + msg73254
2022-01-15 23:47:00cedsetassignedto: pokoli -> ced
messages: + msg73253
2022-01-04 18:44:32cedsetmessages: + msg73097
2022-01-04 18:10:49pokolisetmessages: + msg73096
2022-01-04 18:07:13cedsetmessages: + msg73095
2022-01-04 18:05:13pokolisetmessages: + msg73094
2022-01-04 17:45:43cedsetmessages: + msg73093
2022-01-04 12:23:48reviewbotsetmessages: + msg73085
2022-01-04 11:58:31pokolisetassignedto: acaubet -> pokoli
messages: + msg73084
reviews: 372821002 -> 376391002
2022-01-04 01:05:07cedsetmessages: + msg73083
nosy: + ced
2021-12-15 16:56:01reviewbotsetmessages: + msg72561
2021-12-15 14:26:45reviewbotsetmessages: + msg72554
2021-12-15 14:12:58acaubetsetmessages: + msg72553
2021-12-15 13:58:29reviewbotsetmessages: + msg72552
nosy: + reviewbot
2021-12-15 13:49:23acaubetsetkeyword: + backport
messages: + msg72551
2021-12-15 13:44:30acaubetsetassignedto: acaubet
status: chatting -> testing
2021-12-15 13:44:13acaubetsetkeyword: + review
reviews: 372821002
2021-12-15 12:37:42pokolisetmessages: + msg72549
nosy: + pokoli
2021-12-15 12:22:35acaubetcreate