Messagebox in python during development or debugging

Asked by Deven Moga

Hello,

During development in OpenERP i am getting a problem while i want to debugging the code. I wish if i could display message box that can print values for my debugging purpose.

If anyone tell me how can i print messagebox in OpenERP then it will be very greatful.

Waiting for the valuable reply.
Thanks in advance.

Sincerely,
Deven

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
gpa(OpenERP)
Solved:
Last query:
Last reply:
Revision history for this message
gpa(OpenERP) (gpa-openerp) said :
#1

Hello Deven Moga ,

You can use print statement to debug the code.
For print the message box you can use raise statement to generate the message box.

Example raise osv.except_osv ( _('Back Order Assigned to this Packing.')

Thank you

Revision history for this message
Deven Moga (erpsupport) said :
#2

Hello,

I am getting below error while using your solution :

Environment Information :
System : Linux-2.6.28-17-generic-i686-with-Ubuntu-9.04-jaunty
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty
Operating System Release : 2.6.28-17-generic
Operating System Version : #58-Ubuntu SMP Tue Dec 1 18:57:07 UTC 2009
Operating System Architecture : 32bit
Operating System Locale : en_IN.ISO8859-1
Python Version : 2.6.2
OpenERP-Client Version : 5.0.7
Last revision No. & ID :1031 <email address hidden>
Traceback (most recent call last):
  File "/home/deven/workspace/server/bin/netsvc.py", line 244, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/deven/workspace/server/bin/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/home/deven/workspace/server/bin/addons/audittrail/audittrail.py", line 346, in execute
    res = my_fct(db, uid, passwd, object, method, *args)
  File "/home/deven/workspace/server/bin/addons/audittrail/audittrail.py", line 345, in my_fct
    return fct_src(db, uid, passwd, object, method, *args)
  File "/home/deven/workspace/server/bin/service/web_services.py", line 583, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/home/deven/workspace/server/bin/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/deven/workspace/server/bin/osv/osv.py", line 118, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/deven/workspace/server/bin/osv/osv.py", line 110, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/deven/workspace/server/bin/osv/orm.py", line 1331, in fields_view_get
    xarch, xfields = self.__view_look_dom_arch(cr, user, doc, view_id, context=context)
  File "/home/deven/workspace/server/bin/osv/orm.py", line 1119, in __view_look_dom_arch
    fields = self.fields_get(cr, user, fields_def.keys(), context)
  File "/home/deven/workspace/server/bin/osv/orm.py", line 2131, in fields_get
    return super(orm, self).fields_get(cr, user, fields, context, read_access)
  File "/home/deven/workspace/server/bin/osv/orm.py", line 971, in fields_get
    user, context)
  File "/home/deven/workspace/server/bin/addons/arihant_stage1/arihant_stage1.py", line 101, in _contact_title_get
    return [(r['shortcut'], r['name']) for r in res] + [('','')]
TypeError: __init__() takes at least 3 arguments (2 given)

Please kindly provide me the solution.

Sincerely,
Deven

Revision history for this message
Best gpa(OpenERP) (gpa-openerp) said :
#3

Hello Deven moga,

For debugging purpose you can use print statement nothing else.

For message box i gave a just example of error message box you can not use it directly.

For that you need check some condition when it will raise.

You can find many example in TinyERP code.

But for debugging purpose you can not use message box directly.

You can use the following option when you will start the server from terminal.
--debug enable debug mode

Like
./openerp-server.py --addons-path=../../addons-5.0/ --debug

Thank you

Revision history for this message
Deven Moga (erpsupport) said :
#4

Thanks gpa(Open ERP), that solved my question.