Invoice with Analytical Account Error on Validate

Bug #327510 reported by paulkoan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

Summary:

If Hours Encoding is used to record time, against an Analytical account and journal, with a product for a partner, there are two problems - the product price does not get passed into the line item on the invoice, and when corrected, attempting to validate the order causes a traceback.

Steps to reproduce:

1) Create Partner, Receivables GL account, Sales GL account, Analytic account, Analytic journal, product.

2) Use hours encoding to create some entries for the above analytic account and journal, using the product.

3) Use uninvoice entries to generate an invoice from the analytic account (there is a fix released to allow this to happen)

The first problem is here, the pricing information is not put into the line item. This can be corrected by opening the line item and retyping the product name - it will then pick up the price and tax from the product.

4) Compute taxes, which works fine.

5) Create invoice. The following traceback happens:

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 231, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 74, in __call__
    return getattr(self, method)(*params)
  File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 475, in exec_workflow
    res = service.exec_workflow(db, uid, object, method, id)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 137, in exec_workflow
    res = self.exec_workflow_cr(cr, uid, obj, method, *args)
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 130, in exec_workflow_cr
    return wf_service.trg_validate(uid, obj, args[0], method, cr)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/wkf_service.py", line 81, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/instance.py", line 49, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 62, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 171, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 179, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 42, in create
    process(cr, res, ident, stack=stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 54, in process
    result = _execute(cr, workitem, activity, ident, stack)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/workitem.py", line 107, in _execute
    wkf_expr.execute(cr, ident, workitem, activity)
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/wkf_expr.py", line 68, in execute
    return _eval_expr(cr, ident, workitem, activity['action'])
  File "/usr/lib/python2.5/site-packages/openerp-server/workflow/wkf_expr.py", line 58, in _eval_expr
    ret = eval(line, env)
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/openerp-server/osv/orm.py", line 160, in <lambda>
    return lambda *args, **argv: getattr(self._table, name)(self._cr, self._uid, [self._id], *args, **argv)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/account/invoice.py", line 500, in action_move_create
    iml = self._get_analytic_lines(cr, uid, inv.id)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/hr_timesheet_invoice/hr_timesheet_invoice.py", line 142, in _get_analytic_lines
    iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id)
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/account/invoice.py", line 480, in _get_analytic_lines
    'journal_id': self._get_journal_analytic(cr, uid, inv.type),
  File "/usr/lib/python2.5/site-packages/openerp-server/addons/account/invoice.py", line 85, in _get_journal_analytic
    raise osv.except_osv(_('No Analytic Journal !'),_("You must define an analytic journal of type '%s' !") % (tt,))
  File "/usr/lib/python2.5/site-packages/openerp-server/tools/translate.py", line 62, in __call__
    lang = frame.f_locals.get('context', {}).get('lang', False)
AttributeError: 'NoneType' object has no attribute 'get'

This suggests that there isn't an analytical journal associated with the line item. In the account_invoice_line, the analytic_account ID is correct. In the account_analytic_line, the invoice_id matches the invoice_id for the lines, and has the correct journal_id.

This is 5.0.0-2 with the latest hr_timesheet_invoice_create.py

Changed in openobject-addons:
status: New → 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.