Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

TypeError: cannot marshal None unless allow_none is enabled

v7
By
Martin
on 4/30/13, 12:47 PM 13,024 views

I have a hit the exception ...

 TypeError: cannot marshal None unless allow_none is enabled

... several times already when working with XMLRPC.

While it gives me the clue that I must not allow None types in my data sets, it would really help to enable allow_none, when this occurs, in order to pinpoint which field is null.

How do I enable allow_none on XMLRPC?

5

Naresh Soni (nch)

--Naresh Soni (nch)--
Tiny ERP Pvt Ltd
http://www.odoo.com
1281
| 2 2 4
India
--Naresh Soni (nch)--

Team Lead, Odoo(Formerly OpenERP) Support & OPW

Naresh Soni (nch)
On 4/30/13, 2:39 PM

Hi Martin,

OpenERP's XMLRPC protocol doesn't allow the None values to pass to the client. So you need to replace those None values by False. To identify which values are passed as None just start your server with --log-level='debug_rpc_answer' and check the last rpc_answer sent to the client. Or add "allow_none=True" to all xmlrpc.ServerProxy calls in rpc.py in the GTK client.

Thanks,

Naresh, I was unaware of the --log-level='debug_rpc_answer' switch. That's a hot tip. Thank you! I think I prefer your other suggestion, but it is not clear to me. I access the RPC from my own program by means of https://pypi.python.org/pypi/openerp-client-lib. Do I need to find xmlrpc.ServerProxy calls in it's source code? Doesn't V7 make the GTK client obsolete?

Martin
on 4/30/13, 3:47 PM

Hi Martin, Yes the GTK client is obsolete since V7. And as you are using the openerp-client-lib you will need to change the source code http://bazaar.launchpad.net/~niv-openerp/openerp-client-lib/trunk/view/head:/openerplib/main.py at line 82 you can replace " service = xmlrpclib.ServerProxy(url)" by service = xmlrpclib.ServerProxy(url,allow_none=True)

Naresh Soni (nch)
on 5/1/13, 3:59 AM

So that's a server side setting that my XMLRPC client cannot request or set itself. Is that correct? Sorry to be thick. It's a conceptual thing and I want to be sure we're not talking at cross-purposes. (I come from the Java world and I'm fairly new to OpenERP and Python.)

Martin
on 5/1/13, 7:54 AM

your client can pass the parameter while making the xmlrpclib.ServerProxy object to communicate.

Naresh Soni (nch)
on 5/1/13, 8:35 AM

I'll let you know how I get on as soon as I try it. Thank's so much.

Martin
on 5/2/13, 9:33 AM

You're my hero! (but I have not seen how my "... client can pass the parameter while making the xmlrpclib.ServerProxy object to communicate." How do I do that?)

Martin
on 5/4/13, 11:40 AM

Hi Martin, If you are using openerp-client-lib as you told in your first comment then I have already answer how to pass the parameter in my 2nd comment along with line no to make the changes.

Naresh Soni (nch)
on 5/6/13, 4:28 AM

Naresh. Sorry. You are quite right. I had already worked too many hours when I wrote that. I am indeed using openerp-client-lib, and your solution worked exactly as you said. My addled brain was seeing the library as a service I am using, and I was wondering if there exists a way to tell it to enable and disable None 'on-the-fly'. Perhaps subclassing? This is not at all urgent, however.

Martin
on 5/6/13, 7:56 AM
-1
Dharmesh Rathod
On 4/30/13, 2:04 PM

Hi,

Can you please check that Is there missing value in required fields ?

Email : info@acespritech.com
Skype : acespritech
Blog : acespritechblog.wordpress.com

I'm almost certain there is. But, which field? If I could use allow_none, then I could see. So . . . "How do I enable allow_none on XMLRPC?"

Martin
on 4/30/13, 2:41 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/30/13, 12:47 PM
Seen: 13024 times
Last updated: 3/16/15, 8:10 AM