account and account_financial_report - wrong selection condition on balance report

Bug #582243 reported by Ferdinand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 3

Bug Description

this line in "account_balance.py"
> if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 :
should read
> if res['credit'] > 0 or res['debit'] > 0 or res['balance'] <> 0 :

Related branches

Changed in openobject-addons:
status: New → Confirmed
Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

The problem is shared by the account module (from addons) and the account_financial_report module (from extra-addons).
Also, the comparison should be based on the price accuracy (a balance/credit/debit of 0.00000001 or -0.00000001 is not exactly 0).

I'm uploading a patch for account_financial_report in a couple of hours.

summary: - account_financial_report - wrong selection condition
+ account and account_financial_report - wrong selection condition on
+ balance report
Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Fixed for account_financial_report:

Fixed for 5.0 version on revno 4359 revid <email address hidden> (http://bazaar.launchpad.net/~openerp-commiter/openobject-addons/stable_5.0-extra-addons/revision/4359)

Fixed for 6.0 version on revno 4598 revid <email address hidden> (http://bazaar.launchpad.net/~openerp-commiter/openobject-addons/trunk-extra-addons/revision/4598)

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Attached a patch that applies the same fixes to the account module, can somebody review and commit it?

Revision history for this message
Ferdinand (office-chricar) wrote :

I just wonder if
round(<field>, int(config['price_accuracy'])) "criteria like ==, >" 0:

isn't much clearer

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Yeah,
      round(res['balance'], int(config['price_accuracy'])) != 0
is the same as
      abs(res['balance']) >= 0.5 * 10**-int(config['price_accuracy'])

I used "10**-int(config['price_accuracy'])" cause it is done like that all around the code, but this might be re-factored (on all the code).

Revision history for this message
Ferdinand (office-chricar) wrote :

I strongly vote for "round" -
it's much clearer to read and probably faster executed

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
qdp (OpenERP) (qdp)
Changed in openobject-addons:
importance: Undecided → Low
Revision history for this message
Ferdinand (office-chricar) wrote :

in V6 of today still wrong
account_balance_sheet.py: if account.credit > 0 or account.debit > 0 or account.balance > 0:
account_profit_loss.py: if account.credit > 0 or account.debit > 0 or account.balance > 0:

Revision history for this message
Priyesh (OpenERP) (pso-openerp) wrote :

Hello Ferdinand,

Its fixed in Addons3 branch.

Rev-id: mra@mra-laptop-20101209120918-zssimdszxldnx0v4
Rev-no:4736

Thanks to you and Borja López Soilán for your valuable contribution.

Changed in openobject-addons:
status: Confirmed → In Progress
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.