← Back to team overview

openerp-india team mailing list archive

[Bug 1021151] [NEW] local variable 'company_id' referenced before assignment

 

Public bug reported:

When there's no Chart of Accounts defined, and trying to print Trial
Balance, UnboundLocalError exception is thrown:

  File "/openerp/addons/account/wizard/account_report_common.py", line 35, in onchange_chart_id
    return {'value': {'company_id': company_id}}
UnboundLocalError: local variable 'company_id' referenced before assignment

Very simple and easily notable bug:

    def onchange_chart_id(self, cr, uid, ids, chart_account_id=False, context=None):
        if chart_account_id:
            company_id = self.pool.get('account.account').browse(cr, uid, chart_account_id, context=context).company_id.id
        return {'value': {'company_id': company_id}}

Cheers

** Affects: openobject-addons
     Importance: Undecided
         Status: New


** Tags: account

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1021151

Title:
  local variable 'company_id' referenced before assignment

Status in OpenERP Addons (modules):
  New

Bug description:
  When there's no Chart of Accounts defined, and trying to print Trial
  Balance, UnboundLocalError exception is thrown:

    File "/openerp/addons/account/wizard/account_report_common.py", line 35, in onchange_chart_id
      return {'value': {'company_id': company_id}}
  UnboundLocalError: local variable 'company_id' referenced before assignment

  Very simple and easily notable bug:

      def onchange_chart_id(self, cr, uid, ids, chart_account_id=False, context=None):
          if chart_account_id:
              company_id = self.pool.get('account.account').browse(cr, uid, chart_account_id, context=context).company_id.id
          return {'value': {'company_id': company_id}}

  Cheers

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1021151/+subscriptions


Follow ups

References