[6.1, account] reconciliation _defaults function for 'name' needs to be called with context argument

Bug #947355 reported by Stefan Rijnhart (Opener)
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

Hi,

the function that provides the default name for account.reconcile is called without the context argument in account/account.py", line 1655. Somewhere down the line, the account module's ir_sequence does a context.get() without checking whether context is perhaps None and it all ends in tears.

  File "/home/oerinttst61/openobject-addons/account/account.py", line 1655, in<lambda>
    'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/',
  File "/home/oerinttst61/openobject-server/openerp/addons/base/ir/ir_sequence.py", line 256, in get
    return self.get_id(cr, uid, code, 'code', context)
  File "/home/oerinttst61/openobject-server/openerp/addons/base/ir/ir_sequence.py", line 248, in get_id
    return self.next_by_code(cr, uid, sequence_code_or_id, context)
  File "/home/oerinttst61/openobject-server/openerp/addons/base/ir/ir_sequence.py", line 233, in next_by_code
    return self._next(cr, uid, ids, context)
  File "/home/oerinttst61/openobject-addons/account/ir_sequence.py", line 53, in _next
    if line.fiscalyear_id.id == context.get('fiscalyear_id'):
AttributeError: 'NoneType' object has no attribute 'get'

Cheers,
Stefan.

Related branches

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Good catch Stefane!

Changed in therp-backports:
status: New → Fix Committed
importance: Undecided → Medium
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Stefan,

I have checked your issue and I am agree with your solution, we need to add context on that method.

But I am not able to produce it, So would you please provide the steps to produce this issue.

Thank you!

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Amit,

go to journals -> bank journal. Modify the journal sequence, adding a sub sequence for the current fiscal year. Then, go to an open invoice and click the 'Pay' button. On the voucher, select the 'bank' payment method and confirm.

Cheers,
Stefan.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Stefan's fix was merged in 6.1 at revision [1], so the issue should be fixed now.

Thanks for reporting and taking the time to submit a proper patch!

[1] addons rev. 6696 rev-id: <email address hidden>

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
milestone: none → 6.1
status: New → Fix Released
Changed in therp-backports:
status: Fix Committed → Fix Released
no longer affects: therp-backports
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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