Filter Problems for Financial Report, BS and P&L Reports in OpenERP v6.1and trunk

Bug #1078146 reported by Michael Aldrin Villamar (FS3) on 2012-11-13
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP Publisher's Warranty Team

Bug Description

Target Moves filter in Financial Report, Balance Sheet and Profit & Loss (Accounting > Reporting > Legal Reports > Accounting Reports) does not work properly. It always print 'all entries' even the value of Target Moves is 'all posted entries'. In addition, the period filters does not work if the start and end periods are the same.

Related branches

Download full text (4.1 KiB)

I've created my module to fix these bugs. Here are some parts of the module. Thanks!

#####
# PROBLEM: there is an error when start and end periods are the same.
# SOLUTION: In build_ctx_periods, return the period_from_id with a list

# FILE: account.py
class account_period(osv.osv):
    _inherit = "account.period"

    # FIXED: There is an error if the start and end periods are the same.
    def build_ctx_periods(self, cr, uid, period_from_id, period_to_id):
        if period_from_id == period_to_id:
            return [period_from_id]
        return super(account_period, self).build_ctx_periods(cr, uid, period_from_id=period_from_id, period_to_id=period_to_id)
account_period()
#####

#####
# PROBLEM: Target Moves filter functionality does not work in Financial Report, BS and P&L.
# SOLUTION: Include Target Moves in context.

# FILE: account_financial_report.py
class account_financial_report(osv.osv):
    _inherit = "account.financial.report"

    def _get_balance(self, cr, uid, ids, field_names, args, context=None):
        account_obj = self.pool.get('account.account')
        res = {}
        for report in self.browse(cr, uid, ids, context=context):
            if report.id in res:
                continue
            res[report.id] = dict((fn, 0.0) for fn in field_names)
            if report.type == 'accounts':
                # it's the sum of the linked accounts
                ### Use browse method to include context
                account_ids = []
                for a in report.account_ids:
                    account_ids.append(a.id)
                for b in account_obj.browse(cr, uid, account_ids, context=context):
                    for field in field_names:
                        res[report.id][field] += getattr(b, field)
                ###
            elif report.type == 'account_type':
                # it's the sum the leaf accounts with such an account type
                report_types = [x.id for x in report.account_type_ids]
                account_ids = account_obj.search(cr, uid, [('user_type','in', report_types), ('type','!=','view')], context=context)
                for a in account_obj.browse(cr, uid, account_ids, context=context):
                    for field in field_names:
                        res[report.id][field] += getattr(a, field)
            elif report.type == 'account_report' and report.account_report_id:
                # it's the amount of the linked report
                res2 = self._get_balance(cr, uid, [report.account_report_id.id], field_names, False, context=context)
                for key, value in res2.items():
                    for field in field_names:
                        res[report.id][field] += value[field]
            elif report.type == 'sum':
                # it's the sum of the children of this account.report
                res2 = self._get_balance(cr, uid, [rec.id for rec in report.children_ids], field_names, False, context=context)
                for key, value in res2.items():
                    for field in field_names:
                        res[report.id][field] += value[field]
        return res

    _columns = {
        'balance': fields.function(_get_balance...

Read more...

summary: - Filter Problems for Financial Report, BS and P&L Reports in OpenERP v6.1
+ Filter Problems for Financial Report, BS and P&L Reports in OpenERP
+ v6.1and trunk
Ravish(OpenERP) (rmu-openerp) wrote :

Hello,

I have checked this issue. but it working for same period filter like from 2/12 To 2/12.
For second point,I have attached video, have a look.

Thanks..!!!!

Changed in openobject-addons:
importance: Undecided → Low
status: New → Confirmed
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)

Hi Ravish,

OpenERP 7.0 beta has resolved the issue for the same period.
However, I found the same issue with Target Moves.
The video you've attached has problem. I can't view it properly.

Thank you very much!

Changed in openobject-addons:
assignee: OpenERP R&D Addons Team 3 (openerp-dev-addons3) → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance

Hello,

Sorry for the long delay on this one but we have finally merged a fix for this bug in 7.0.

revno: 9408 [merge]
revision-id: <email address hidden>

Thanks for the report

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

Duplicates of this bug

Other bug subscribers

Bug attachments