تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
1468 أدوات العرض

Why do I get this error?

    "Cannot marshal None unless allow_none is enabled"

models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url), allow_none=True)
lead_ids = models.execute_kw(db, uid, password,
'crm.lead', 'search',
[[]])
leads = models.execute_kw(db, uid, password,
'crm.lead', 'read',
[lead_ids, ['name', 'lead_properties']]) # Empty list fetches all fields

As you can see I did tell it allow_none=True 

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Man, this forum is annoying sometimes.

I made a change to  slash usr slash lib slash python3 slash dist-packages slash odoo slash addons slash base controllers slash rpc.py

I had to type it that way because the forum thought I was trying to paste a URL, which it wasn't.  Anyhow:

def _xmlrpc(self, service):
    """Common method to handle an XML-RPC request."""
    data = request.httprequest.get_data()
    params, method = xmlrpc.client.loads(data)
    result = dispatch_rpc(service, method, params)
    return xmlrpc.client.dumps((result,), methodresponse=1, allow_none=True)


I have no idea if this patch is safe or not but it does fix the problem.


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أبريل 24
1518
2
مارس 24
2077
0
سبتمبر 23
1153
1
يونيو 23
1697
xmlrpc search_read تم الحل
1
يونيو 23
1918