Calculate the Opening Balance for Opening Entries in Account Voucher

Registered by hbto [Vauxoo] http://www.vauxoo.com

Currently account_voucher allows loading the opening balance for an account whenever there are no move_lines of aml.journal.type<>'situation', i.e.: count(aml.journal.type<>'situation')=0.

This always will be true only if within these condition:

count(aml.journal.type=situation') = 0 and count(aml.journal.type<>'situation')=0, when this is true the Opening Balance Value is written in the account_move of the journal of type situation assigned to the accountt. It's OK,
count(aml.journal.type=situation') = 1 and count(aml.journal.type<>'situation')=0, when this is true the only available aml.journal.type='situation' is overridden. the Opening Balance Value is written in the right place, It's OK,

But with these conditions everything is a different story:

count(aml.journal.type=situation') > 1 and count(aml.journal.type<>'situation')=0, when this is true all available aml.journal.type='situation' are overridden with the same Opening Balance Value, leading to have a Actual Opening Balance N times greater than Opening Balance Value. It's wrong.

count(aml.journal.type<>'situation')>0 when this is true, it is not allowed to update the opening balance value. We (Netquatro Team) think is wrong because after aperture, and having made other entry lines, you should still be able to change the opening balance value, because you could think that the value that you wrote at that time was wrong and want to correct it now.

At the end of the day with the current module account_voucher, the Opening Balance Value is only gotten from manual input and there is no way to get that a value from the entry lines of journal.type = 'situation'
__________________

The Solution to this issue has two approaches that we are addressing:

*First, Manually Updating the Opening Balance Value in the account by doing the math of the entries and taking into account the user type of the account, deferral method (write a new module enhancing the method of the account_voucher)

we would like to allow making changes to the Opening Balance Value no matter if count(aml.journal.type<>'situation')>=0 and count(aml.journal.type=situation') >=0 but taking into account the state of the account_move and the deferral method of the account, we have some bouts about this control if somebody can explain another one should be great!

If the deferral method of the account being updated is:
1) deferral method = none: rise_excepction "It is not allowed to load Opening Balance to an account whose deferral method is none"
this is related to this bug https://bugs.launchpad.net/openobject-addons/+bug/560378
2) deferral method = unreconciled or detail

a.- count(aml.journal.type=situation') = 0, when this is true the Opening Balance Value is written in the account_move of the journal of type situation assigned to the account. This is doing the same what is doing the current account_voucher module but for count(aml.journal.type<>'situation')>=0

b.- count(aml.journal.type=situation') >= 1, when this is true the result of [+/-]Opening_Balance_Value-(Debit-Credit) is written on a new move_line

3) deferral method = balance

a.- count(aml.journal.type=situation') = 0, when this is true the Opening Balance Value is written in the account_move of the journal of type situation assigned to the account. This is doing the same what is doing the current account_voucher module but for count(aml.journal.type<>'situation')>=0

b.- count(aml.journal.type=situation') = 1, when this is true the only available aml.journal.type='situation' is overridden with Opening_Balance_Value.

c.- count(aml.journal.type=situation') > 1, when this is true the result of [+/-]Opening_Balance_Value-(Debit-Credit) is written on a new move_line

Though I think that 3b and 3c should be one where count(aml.journal.type=situation') >= 1, when this is true the previous available aml.journal.type='situation' are deleted and is written a new move_line in the account_move of the journal of type situation assigned to the account

*Updating through a Wizard the Opening Balance in the account based on the entries lines written in the journal(s) of type situation for that account (write a new module)

This wizard will allow an account or the account being selected to be updated the Opening Balance Value based on the lines written on the move(s) of journal(s) of type='situation'

This way getting reconciled the reported Opening Balance shown in the view of the account and the actual Opening Balance resulting from the sum of the situation entries.

Regards.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
hbto [Vauxoo] http://www.vauxoo.com
Direction:
Needs approval
Assignee:
Nhomar - Vauxoo
Definition:
Pending Approval
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Nhomar - Vauxoo
Completed by
Nhomar - Vauxoo

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.