Issue 11057

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

Created on 2021-12-15.12:22:35 by acaubet, last changed 3 months ago by roundup-bot.

Files

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

Messages

New changeset 756754b57ae9 by Cédric Krier in branch '6.2':
Compute deferral balance by cumulating children account
https://hg.tryton.org/modules/account/rev/756754b57ae9

New changeset 5b9ee9781a0f by Cédric Krier in branch '6.0':
Compute deferral balance by cumulating children account
https://hg.tryton.org/modules/account/rev/5b9ee9781a0f

New changeset 226b2fb53672 by Cédric Krier in branch '5.0':
Compute deferral balance by cumulating children account
https://hg.tryton.org/modules/account/rev/226b2fb53672
New changeset 9544fc428fb6 by Cédric Krier in branch 'default':
Compute deferral balance by cumulating children account
https://hg.tryton.org/tryton-env/rev/9544fc428fb6

New changeset e2f4c2e9f023 by Cédric Krier in branch 'default':
Add test scenario for closing fiscal year
https://hg.tryton.org/tryton-env/rev/e2f4c2e9f023
New changeset 5457ef491963 by Cédric Krier in branch 'default':
Compute deferral balance by cumulating children account
https://hg.tryton.org/modules/account/rev/5457ef491963

New changeset 543d8eabc6ee by Cédric Krier in branch 'default':
Add test scenario for closing fiscal year
https://hg.tryton.org/modules/account/rev/543d8eabc6ee
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-02-07 23:34:21roundup-botsetkeyword: - backport
messages: + msg73927
2022-02-03 22:22:10roundup-botsetmessages: + msg73760
2022-02-03 22:21:54roundup-botsetmessages: + msg73759
nosy: + roundup-bot
status: testing -> resolved
2022-01-24 17:43:58reviewbotsetmessages: + msg73510
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

Showing 10 items. Show all history (warning: this could be VERY long)