Open PauMB85 opened 1 year ago
The error message suggests that the issue is related to the inability of the xmlrpc.client module to serialize the object of type defaultdict, which is being returned by the 'purchase.order' model.
To resolve this error, you can try to convert the defaultdict object into a regular dictionary before returning it. You can use the dict() function to achieve this conversion.
For example, you can modify the code as follows:
uid = common.authenticate(db, username, password, {}) models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url)) purchase_orders = models.execute_kw(db, uid, password, 'purchase.order', 'search_read', []) for order in purchase_orders: order['tax_totals'] = dict(order['tax_totals']) # Convert defaultdict to regular dictionary
This should convert the 'tax_totals' field from a defaultdict object to a regular dictionary, which should be serializable by the xmlrpc.client module.
Alternatively, you can try to use a different serialization method such as JSON instead of XML-RPC to avoid this issue.
I can't reproduce the problem in v16.
Anyway, the solution should be adding exportable=False
and patching check_field_access_rights
method.
https://github.com/odoo/odoo/pull/110699
If you want us make further investigation you should report a ticket via https://odoo.com/help
could it be like https://github.com/odoo/odoo/pull/75417 ?
Impacted versions:
{'server_version': 'saas~16.1+e', 'server_version_info': ['saas~16', 1, 0, 'final', 0, 'e'], 'server_serie': 'saas~16.1', 'protocol_version': 1}
Steps to reproduce:
uid = common.authenticate(db, username, password, {}) models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url)) PURCHARSE_ORDER = models.execute_kw(db, uid, password, 'purchase.order', 'search_read', [])
Current behavior: When execute the PURCHARSE_ORDER, always is generated an belong error
in next step I filter the fields and the problem is when use the field: `tax_totals, this field is an object
Expected behavior:
When call the api, at the model 'purchase.order', we don't receive this error.
Video/Screenshot link (optional):
Support ticket number submitted via odoo.com/help (optional):