credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #04764
[Bug 785427] Re: [stable 6.0.2] Profit and Loss parser logic error leads to incorrect totals
** Branch linked: lp:~credativ/openobject-addons/6.0-fix785427
--
You received this bug notification because you are a member of credativ,
which is the registrant for credativ-openerp.
https://bugs.launchpad.net/bugs/785427
Title:
[stable 6.0.2] Profit and Loss parser logic error leads to incorrect
totals
Status in OpenERP addons & packages developed by credativ:
New
Status in credativ-openerp addons-6.0 series:
Fix Released
Status in OpenERP Addons (modules):
Confirmed
Bug description:
In the P&L parser you have the following code
if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += abs(account.debit - account.credit)
if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += abs(account.debit - account.credit)
It is clearly incorrect - while it will work fine for those accounts
that have the expected - or + balance imagine this situation (or any 1
of a 100 other normal business or accounts setups).
Lets say I offer rebates, but those rebates are not an expense, really
they are a reduction in sales revenue, so I declare them as income
(quite correctly, at least in my country), now instead of subtracting
those rebates from the income total, I add them. My income increases?
By offering rebates? My Sales Manager just retired very rich.
Take another really common example - any salespeople reading -
salespeople jam their accounts full of product at the end of a fiscal
period to maximise their commission. Then in the first month of the
period, all that product comes back and sales are actually negative
for a while.
What about FX Gains/Losses account or writeoff accounts. Typically
these are expense accounts, but sometimes we get lucky and they go in
our favour. But now we don't realise the benefit it is subtracted
from our profit (well added to our expenses, which reduces our profit)
You cannot use absolute value in any reports or functions relating to
account.balances, you must either use the value, or the inverse of the
value depending on whether it is defined as a debit or credit account.
Or alternatively for debit accounts go dr-cr, and for credit, go cr-
dr. In fact, anytime abs is used in relation to anything accounting
this should be raising a big red flag.
To manage notifications about this bug go to:
https://bugs.launchpad.net/credativ-openerp/+bug/785427/+subscriptions