[stable 6.0.2] Profit and Loss parser logic error leads to incorrect totals
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Confirmed
|
Wishlist
|
OpenERP R&D Addons Team 3 | ||
credativ-openerp |
New
|
Undecided
|
Unassigned | ||
Addons-6.0 |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
In the P&L parser you have the following code
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.
Currently we are not calculating GP or GL separately in Profit and Loss report.
So I am setting this issue for future road map.
Thanks.