OCA / odoorpc

Python module to pilot your Odoo servers through JSON-RPC.
http://pythonhosted.org/OdooRPC/
GNU Lesser General Public License v3.0
231 stars 123 forks source link

Model account.move can not be accessed on Odoo 16 #87

Closed NateLeeg96 closed 1 year ago

NateLeeg96 commented 1 year ago

I cannot access records of the model account.move in Odoo Version 16 with OdooRPC running on a Raspberry Pi with Python 3.5.3.

Affected Version: OdooRPC 0.7.0, 0.9.0 Odoo 16

Steps to reproduce the behavior:

  1. odoo.env['account.move'].browse(ID)

Expected behavior Should return a record

It returns the following error:

File "test.py", line 10, in <module>
    AccountMove = odoo.env['account.move'].browse(1460)
  File "/home/pi/.local/lib/python3.5/site-packages/odoorpc/models.py", line 280, in browse
    return cls._browse(cls.env, ids)
  File "/home/pi/.local/lib/python3.5/site-packages/odoorpc/models.py", line 246, in _browse
    records._init_values()
  File "/home/pi/.local/lib/python3.5/site-packages/odoorpc/models.py", line 361, in _init_values
    self.ids, basic_fields, context=context, load='_classic_write')
  File "/home/pi/.local/lib/python3.5/site-packages/odoorpc/models.py", line 74, in rpc_method
    cls._name, method, args, kwargs)
  File "/home/pi/.local/lib/python3.5/site-packages/odoorpc/odoo.py", line 486, in execute_kw
    'args': args_to_send})
  File "/home/pi/.local/lib/python3.5/site-packages/odoorpc/odoo.py", line 285, in json
    data['error'])
odoorpc.error.RPCError: keys must be str, int, float, bool or None, not frozendict
sebalix commented 1 year ago

Hello @NateLeeg96

I analyzed the issue and answered it here: https://github.com/OCA/odoorpc/issues/90#issuecomment-1690445593

Sadly this is a bug in the RPC layer of Odoo, not OdooRPC. Here I can see you are using browse so the workaround I posted in my comment on the issue above won't work. What you can do in your case is this:

AccountMove = odoo.env['account.move']
del AccountMove._columns["compute_all_tax"]
AccountMove.browse(IDS)

Regards,