[trunk] general ledger -

Bug #656378 reported by Ferdinand
8
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

account_general_ledger.py

           elif self.display_account == 'bal_solde':
                if child_account.type != 'view' and num_entry <> 0 :
                    if ( sold_account <> 0.0):
                        res.append(child_account)

for accountants it is important to only exclude accounts which have all values of a line != 0

meaning
do not print account if
* sold_account = 0 AND debit = 0 AND credit = 0 AND INITIAL/OPENING = 0
(did not investigate the field names )

it would also reduce a lot of output if
"With all values is not equal to 0"
is set to default (I know this can be done using RMB but requires unnecessary user/admin/partner interaction)

Related branches

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

BTW 2
it is necessary to
round(value,precision) to make this check work due to internal float calculation

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

This is not related to rounding issues. Filters are performed at PostgreSQL layer and postgreSQL store and compute values in Decimal. So, you can not use rounding issues on such view.

For me it's not a bug, the criteria are applied as a filter on the data on which you perform the computation (not on the final result). So, if you have the following movements:
  PC1 Stock +1
  PC1 Stock -1

If you apply a filter Qty <> 0, these two lines will be used in the computation because their Qty <> 0, the final result will be:
  PC1 Stock 0

So, it's correct.

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

Fabien, I think your comment applies to bug 654861 not this one.

Here it is obvious that the comparison is done at python level and it is making the mistake of not using an epsilon (http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm).

Changed in openobject-addons:
status: Invalid → New
status: New → Confirmed
Revision history for this message
Ferdinand (office-chricar) wrote :

account/report/account_general_ledger.py
IMHO high risk
==>> sum_balance += self.cr.fetchone()[0] or 0.0

    def _sum_balance_account(self, account):
        if account.type == 'view':
            return account.balance
        move_state = ['draft','posted']
        if self.target_move == 'posted':
            move_state = ['posted','']
        self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
                FROM account_move_line l \
                JOIN account_move am ON (am.id = l.move_id) \
                WHERE (l.account_id = %s) \
                AND (am.state IN %s) \
                AND '+ self.query +' '
                ,(account.id, tuple(move_state)))
        sum_balance = self.cr.fetchone()[0] or 0.0
        if self.init_balance:
            self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
                    FROM account_move_line l \
                    JOIN account_move am ON (am.id = l.move_id) \
                    WHERE (l.account_id = %s) \
                    AND (am.state IN %s) \
                    AND '+ self.init_query +' '
                    ,(account.id, tuple(move_state)))
            # Add initial balance to the result
            sum_balance += self.cr.fetchone()[0] or 0.0
        return sum_balance

Revision history for this message
qdp (OpenERP) (qdp) wrote :

i do not understand the problem depicted in this bug report. Is it only a matter of showing less/more accounts in the general ledger when we select the option 'with balance <> 0' ?

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
status: Confirmed → Incomplete
Revision history for this message
qdp (OpenERP) (qdp) wrote :

i do not understand the problem depicted in this bug report. Is it only a matter of choosing wich accounts to show in the general ledger when we select the option 'with balance <> 0' ?

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

1) python math
sum_balance += self.cr.fetchone()[0] or 0.0
might create a value of +/- 0.000000015 or something like that and will missmatch 'with balance <> 0'

2) accounting needs
do not print account if
* sold_account = 0 AND debit = 0 AND credit = 0 AND INITIAL/OPENING = 0
all of these values must be 0 to exclude from printing

Changed in openobject-addons:
importance: Undecided → Low
status: Incomplete → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Ashvin Rathod (OpenERP) (ara-tinyerp) wrote :

hello Ferdinand,

I have fixed the problem in lp:~openerp-dev/openobject-addons/trunk-dev-addons3-ara branch, It will be merged soon with trunk-dev-addons3.

Revision No: 4617
Revision ID: <email address hidden>

Thank you,
ara

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → 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.