*** This bug is a duplicate of bug 869936 ***
    https://bugs.launchpad.net/bugs/869936

Hello Yannick,

Its not the case ! just the new exception_handling needs to be written for 
net_rpc. Try using xml_rpc your user exception will work.
as I mention in my comment #6 the bug is already opened for that lp:869936. we 
need to do something like the below around netrpc_server.py in framework.

=== modified file 'openerp/service/netrpc_server.py'
--- openerp/service/netrpc_server.py    2011-11-22 08:58:48 +0000
+++ openerp/service/netrpc_server.py    2011-12-14 09:15:41 +0000
@@ -31,7 +31,7 @@
 import sys
 import threading
 import traceback
-
+import openerp
 import openerp.netsvc as netsvc
 import openerp.tiny_socket as tiny_socket
 import openerp.tools as tools
@@ -66,7 +66,7 @@
                 break
             except Exception, e:
                 try:
-                    new_e = Exception(tools.exception_to_unicode(e)) # avoid 
problems of pickeling
+                    new_e = Exception(netrpc_handle_exception_legacy(e)) 
                     tb = getattr(e, 'traceback', sys.exc_info())
                     tb_s = "".join(traceback.format_exception(*tb))
                     logging.getLogger('web-services').debug("netrpc: 
communication-level exception", exc_info=True)
@@ -85,7 +85,17 @@
 
     def stop(self):
         self.running = False
-
+        
+def netrpc_handle_exception_legacy(e):
+    if isinstance(e, openerp.osv.osv.except_osv):
+        fault = 'warning -- ' + e.name + '\n\n' + e.value
+    elif isinstance(e, openerp.exceptions.Warning):
+        fault = 'warning -- Warning\n\n' + str(e)
+    elif isinstance(e, openerp.exceptions.AccessError):
+        fault = 'warning -- AccessError\n\n' + str(e)
+    elif isinstance(e, openerp.exceptions.AccessDenied):
+        fault = 'AccessDenied ' + str(e)
+    return fault

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

Title:
  [6.1] UserError exception not displayed

Status in OpenERP Server:
  Incomplete

Bug description:
  Hello,

  In revision 2024 or before of GTK client, UserError are not displayed
  anymore.

  As an example, here is screen capture of the error defined in 
accout/account.py @line 1393
      def unlink(self, cr, uid, ids, context=None, check=True):
          if context is None:
              context = {}
          toremove = []
          obj_move_line = self.pool.get('account.move.line')
          for move in self.browse(cr, uid, ids, context=context):
              if move['state'] != 'draft':
                  raise osv.except_osv(_('UserError'),   # <---------
                          _('You can not delete a posted journal entry "%s"!') 
% \
                                  move['name'])
              line_ids = map(lambda x: x.id, move.line_id)
              context['journal_id'] = move.journal_id.id
              context['period_id'] = move.period_id.id
              obj_move_line._update_check(cr, uid, line_ids, context)
              obj_move_line.unlink(cr, uid, line_ids, context=context)
              toremove.append(move.id)
          result = super(account_move, self).unlink(cr, uid, toremove, context)
          return result

  
  Regards,
  Yannick

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

_______________________________________________
Mailing list: https://launchpad.net/~c2c-oerpscenario
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~c2c-oerpscenario
More help   : https://help.launchpad.net/ListHelp

Reply via email to