← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 798715] [NEW] [PS] Bug reported when trying to invoice an expense

 

Public bug reported:

Trunk; server revno 3461 and addons revno 4784
Linux

* Human Resources > Expenses > Expenses, create an expense and add expense lines
* Confirm, approve and click on "invoice"

Obtained result : the following error is reported

Environment Information : 
System : Linux-2.6.32-32-generic-i686-with-Ubuntu-10.04-lucid
OS Name : posix
Distributor ID:	Ubuntu
Description:	Ubuntu 10.04.2 LTS
Release:	10.04
Codename:	lucid
Operating System Release : 2.6.32-32-generic
Operating System Version : #62-Ubuntu SMP Wed Apr 20 21:54:21 UTC 2011
Operating System Architecture : 32bit
Operating System Locale : fr_BE.UTF8
Python Version : 2.6.5
OpenERP-Client Version : 6.1-dev
Last revision No. & ID :1909 nch@xxxxxxxxxxx-20110614111856-4mgrqyeypbluofin
<type 'exceptions.NameError'>
Python 2.6.5: /usr/bin/python
Fri Jun 17 15:58:56 2011

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /home/openerp/trunk/server/openerp/netsvc.py in dispatch(self=<openerp.service.http_server.XMLRPCRequestHandler instance>, service_name='object', method='execute', params=('trunk', 1, 'admin', 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}))
  426             self.log('service', tuple(replace_request_password(params)), depth=(None if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='%s.%s'%(service_name,method))
  427             auth = getattr(self, 'auth_provider', None)
  428             result = ExportService.getService(service_name).dispatch(method, auth, params)
  429             self.log('result', result, channel=logging.DEBUG_RPC_ANSWER)
  430             return result
result undefined
global ExportService = <class 'openerp.netsvc.ExportService'>
ExportService.getService = <bound method type.getService of <class 'openerp.netsvc.ExportService'>>
service_name = 'object'
).dispatch undefined
method = 'execute'
auth = None
params = ('trunk', 1, 'admin', 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})

 /home/openerp/trunk/server/openerp/service/web_services.py in dispatch(self=<openerp.service.web_services.objects_proxy object>, method='execute', auth=None, params=('hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}))
  577         ls = netsvc.LocalService('object_proxy')
  578         fn = getattr(ls, method)
  579         res = fn(db, uid, *params)
  580         return res
  581 
res undefined
fn = <bound method object_proxy.execute of <openerp.osv.osv.object_proxy object>>
db = 'trunk'
uid = 1
params = ('hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})

 /home/openerp/trunk/server/openerp/osv/osv.py in wrapper(self=<openerp.osv.osv.object_proxy object>, dbname='trunk', *args=(1, 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}), **kwargs={})
  120                 if pooler.get_pool(dbname)._init:
  121                     raise except_osv('Database not ready', 'Currently, this database is not fully loaded and can not be used.')
  122                 return f(self, dbname, *args, **kwargs)
  123             except orm.except_orm, inst:
  124                 if inst.name == 'AccessError':
f = <function execute>
self = <openerp.osv.osv.object_proxy object>
dbname = 'trunk'
args = (1, 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
kwargs = {}

 /home/openerp/trunk/server/openerp/osv/osv.py in execute(self=<openerp.osv.osv.object_proxy object>, db='trunk', uid=1, obj='hr.expense.expense', method='invoice', *args=([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}), **kw={})
  174                 if method.startswith('_'):
  175                     raise except_osv('Access Denied', 'Private methods (such as %s) cannot be called remotely.' % (method,))
  176                 res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  177                 if res is None:
  178                     self.logger.warning('The method %s of the object %s can not return `None` !', method, obj)
res undefined
self = <openerp.osv.osv.object_proxy object>
self.execute_cr = <bound method object_proxy.execute_cr of <openerp.osv.osv.object_proxy object>>
cr = <openerp.sql_db.Cursor object>
uid = 1
obj = 'hr.expense.expense'
method = 'invoice'
args = ([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
kw = {}

 /home/openerp/trunk/server/openerp/osv/osv.py in execute_cr(self=<openerp.osv.osv.object_proxy object>, cr=<openerp.sql_db.Cursor object>, uid=1, obj='hr.expense.expense', method='invoice', *args=([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}), **kw={})
  165         if not object:
  166             raise except_osv('Object Error', 'Object %s doesn\'t exist' % str(obj))
  167         return getattr(object, method)(cr, uid, *args, **kw)
  168 
  169     @check
builtingetattr = <built-in function getattr>
object = <hr_expense.hr_expense.hr_expense_expense object>
method = 'invoice'
cr = <openerp.sql_db.Cursor object>
uid = 1
args = ([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
kw = {}

 /home/openerp/trunk/server/openerp/addons/hr_expense/hr_expense.py in invoice(self=<hr_expense.hr_expense.hr_expense_expense object>, cr=<openerp.sql_db.Cursor object>, uid=1, ids=[4], context={'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
  125 
  126     def invoice(self, cr, uid, ids, context=None):
  127         wf_service = netsvc.LocalService("workflow")
  128         mod_obj = self.pool.get('ir.model.data')
  129         res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
wf_service undefined
netsvc undefined
<type 'exceptions.NameError'>: global name 'netsvc' is not defined
    __class__ = <type 'exceptions.NameError'>
    __delattr__ = <method-wrapper '__delattr__' of exceptions.NameError object>
    __dict__ = {}
    __doc__ = 'Name not found globally.'
    __format__ = <built-in method __format__ of exceptions.NameError object>
    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.NameError object>
    __getitem__ = <method-wrapper '__getitem__' of exceptions.NameError object>
    __getslice__ = <method-wrapper '__getslice__' of exceptions.NameError object>
    __hash__ = <method-wrapper '__hash__' of exceptions.NameError object>
    __init__ = <method-wrapper '__init__' of exceptions.NameError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of exceptions.NameError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.NameError object>
    __repr__ = <method-wrapper '__repr__' of exceptions.NameError object>
    __setattr__ = <method-wrapper '__setattr__' of exceptions.NameError object>
    __setstate__ = <built-in method __setstate__ of exceptions.NameError object>
    __sizeof__ = <built-in method __sizeof__ of exceptions.NameError object>
    __str__ = <method-wrapper '__str__' of exceptions.NameError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __unicode__ = <built-in method __unicode__ of exceptions.NameError object>
    args = ("global name 'netsvc' is not defined",)
    message = "global name 'netsvc' is not defined"

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/home/openerp/trunk/server/openerp/netsvc.py", line 428, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/openerp/trunk/server/openerp/service/web_services.py", line 579, in dispatch
    res = fn(db, uid, *params)
  File "/home/openerp/trunk/server/openerp/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/openerp/trunk/server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/openerp/trunk/server/openerp/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/openerp/trunk/server/openerp/addons/hr_expense/hr_expense.py", line 127, in invoice
    wf_service = netsvc.LocalService("workflow")
NameError: global name 'netsvc' is not defined

Expected result : it generates the invoice for the expense

reported by dha, OpenERP Prof Serv

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


** Tags: profserv

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/798715

Title:
  [PS] Bug reported when trying to invoice an expense

Status in OpenERP Modules (addons):
  New

Bug description:
  Trunk; server revno 3461 and addons revno 4784
  Linux

  * Human Resources > Expenses > Expenses, create an expense and add expense lines
  * Confirm, approve and click on "invoice"

  Obtained result : the following error is reported

  Environment Information : 
  System : Linux-2.6.32-32-generic-i686-with-Ubuntu-10.04-lucid
  OS Name : posix
  Distributor ID:	Ubuntu
  Description:	Ubuntu 10.04.2 LTS
  Release:	10.04
  Codename:	lucid
  Operating System Release : 2.6.32-32-generic
  Operating System Version : #62-Ubuntu SMP Wed Apr 20 21:54:21 UTC 2011
  Operating System Architecture : 32bit
  Operating System Locale : fr_BE.UTF8
  Python Version : 2.6.5
  OpenERP-Client Version : 6.1-dev
  Last revision No. & ID :1909 nch@xxxxxxxxxxx-20110614111856-4mgrqyeypbluofin
  <type 'exceptions.NameError'>
  Python 2.6.5: /usr/bin/python
  Fri Jun 17 15:58:56 2011

  A problem occurred in a Python script.  Here is the sequence of
  function calls leading up to the error, in the order they occurred.

   /home/openerp/trunk/server/openerp/netsvc.py in dispatch(self=<openerp.service.http_server.XMLRPCRequestHandler instance>, service_name='object', method='execute', params=('trunk', 1, 'admin', 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}))
    426             self.log('service', tuple(replace_request_password(params)), depth=(None if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='%s.%s'%(service_name,method))
    427             auth = getattr(self, 'auth_provider', None)
    428             result = ExportService.getService(service_name).dispatch(method, auth, params)
    429             self.log('result', result, channel=logging.DEBUG_RPC_ANSWER)
    430             return result
  result undefined
  global ExportService = <class 'openerp.netsvc.ExportService'>
  ExportService.getService = <bound method type.getService of <class 'openerp.netsvc.ExportService'>>
  service_name = 'object'
  ).dispatch undefined
  method = 'execute'
  auth = None
  params = ('trunk', 1, 'admin', 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})

   /home/openerp/trunk/server/openerp/service/web_services.py in dispatch(self=<openerp.service.web_services.objects_proxy object>, method='execute', auth=None, params=('hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}))
    577         ls = netsvc.LocalService('object_proxy')
    578         fn = getattr(ls, method)
    579         res = fn(db, uid, *params)
    580         return res
    581 
  res undefined
  fn = <bound method object_proxy.execute of <openerp.osv.osv.object_proxy object>>
  db = 'trunk'
  uid = 1
  params = ('hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})

   /home/openerp/trunk/server/openerp/osv/osv.py in wrapper(self=<openerp.osv.osv.object_proxy object>, dbname='trunk', *args=(1, 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}), **kwargs={})
    120                 if pooler.get_pool(dbname)._init:
    121                     raise except_osv('Database not ready', 'Currently, this database is not fully loaded and can not be used.')
    122                 return f(self, dbname, *args, **kwargs)
    123             except orm.except_orm, inst:
    124                 if inst.name == 'AccessError':
  f = <function execute>
  self = <openerp.osv.osv.object_proxy object>
  dbname = 'trunk'
  args = (1, 'hr.expense.expense', 'invoice', [4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
  kwargs = {}

   /home/openerp/trunk/server/openerp/osv/osv.py in execute(self=<openerp.osv.osv.object_proxy object>, db='trunk', uid=1, obj='hr.expense.expense', method='invoice', *args=([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}), **kw={})
    174                 if method.startswith('_'):
    175                     raise except_osv('Access Denied', 'Private methods (such as %s) cannot be called remotely.' % (method,))
    176                 res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    177                 if res is None:
    178                     self.logger.warning('The method %s of the object %s can not return `None` !', method, obj)
  res undefined
  self = <openerp.osv.osv.object_proxy object>
  self.execute_cr = <bound method object_proxy.execute_cr of <openerp.osv.osv.object_proxy object>>
  cr = <openerp.sql_db.Cursor object>
  uid = 1
  obj = 'hr.expense.expense'
  method = 'invoice'
  args = ([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
  kw = {}

   /home/openerp/trunk/server/openerp/osv/osv.py in execute_cr(self=<openerp.osv.osv.object_proxy object>, cr=<openerp.sql_db.Cursor object>, uid=1, obj='hr.expense.expense', method='invoice', *args=([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False}), **kw={})
    165         if not object:
    166             raise except_osv('Object Error', 'Object %s doesn\'t exist' % str(obj))
    167         return getattr(object, method)(cr, uid, *args, **kw)
    168 
    169     @check
  builtingetattr = <built-in function getattr>
  object = <hr_expense.hr_expense.hr_expense_expense object>
  method = 'invoice'
  cr = <openerp.sql_db.Cursor object>
  uid = 1
  args = ([4], {'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
  kw = {}

   /home/openerp/trunk/server/openerp/addons/hr_expense/hr_expense.py in invoice(self=<hr_expense.hr_expense.hr_expense_expense object>, cr=<openerp.sql_db.Cursor object>, uid=1, ids=[4], context={'active_id': 300, 'active_ids': [300], 'active_model': 'ir.ui.menu', 'department_id': False, 'lang': 'en_US', 'project_id': False, 'search_default_user_id': 1, 'section_id': False, 'tz': False})
    125 
    126     def invoice(self, cr, uid, ids, context=None):
    127         wf_service = netsvc.LocalService("workflow")
    128         mod_obj = self.pool.get('ir.model.data')
    129         res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
  wf_service undefined
  netsvc undefined
  <type 'exceptions.NameError'>: global name 'netsvc' is not defined
      __class__ = <type 'exceptions.NameError'>
      __delattr__ = <method-wrapper '__delattr__' of exceptions.NameError object>
      __dict__ = {}
      __doc__ = 'Name not found globally.'
      __format__ = <built-in method __format__ of exceptions.NameError object>
      __getattribute__ = <method-wrapper '__getattribute__' of exceptions.NameError object>
      __getitem__ = <method-wrapper '__getitem__' of exceptions.NameError object>
      __getslice__ = <method-wrapper '__getslice__' of exceptions.NameError object>
      __hash__ = <method-wrapper '__hash__' of exceptions.NameError object>
      __init__ = <method-wrapper '__init__' of exceptions.NameError object>
      __new__ = <built-in method __new__ of type object>
      __reduce__ = <built-in method __reduce__ of exceptions.NameError object>
      __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.NameError object>
      __repr__ = <method-wrapper '__repr__' of exceptions.NameError object>
      __setattr__ = <method-wrapper '__setattr__' of exceptions.NameError object>
      __setstate__ = <built-in method __setstate__ of exceptions.NameError object>
      __sizeof__ = <built-in method __sizeof__ of exceptions.NameError object>
      __str__ = <method-wrapper '__str__' of exceptions.NameError object>
      __subclasshook__ = <built-in method __subclasshook__ of type object>
      __unicode__ = <built-in method __unicode__ of exceptions.NameError object>
      args = ("global name 'netsvc' is not defined",)
      message = "global name 'netsvc' is not defined"

  The above is a description of an error in a Python program.  Here is
  the original traceback:

  Traceback (most recent call last):
    File "/home/openerp/trunk/server/openerp/netsvc.py", line 428, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/home/openerp/trunk/server/openerp/service/web_services.py", line 579, in dispatch
      res = fn(db, uid, *params)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/openerp/trunk/server/openerp/addons/hr_expense/hr_expense.py", line 127, in invoice
      wf_service = netsvc.LocalService("workflow")
  NameError: global name 'netsvc' is not defined

  Expected result : it generates the invoice for the expense

  reported by dha, OpenERP Prof Serv

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


Follow ups

References