-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
odoorpc is not able to manage jsonfield in v16 (account_move_line with analytic_distribution) #90
Comments
Hello, I tested, and JSON field o.env["account.move.line"].read(IDS, ["compute_all_tax"]) o.env["account.move.line"].read([8830], ["compute_all_tax"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/salix/dev/OCA/odoorpc/odoorpc/models.py", line 59, in rpc_method
result = cls._odoo.execute_kw(cls._name, method, args, kwargs)
File "/home/salix/dev/OCA/odoorpc/odoorpc/odoo.py", line 524, in execute_kw
data = self.json(
File "/home/salix/dev/OCA/odoorpc/odoorpc/odoo.py", line 273, in json
raise error.RPCError(
odoorpc.error.RPCError: keys must be str, int, float, bool or None, not frozendict An 2023-08-23 18:13:08,486 1 ERROR DB-20230807-164544 odoo.http: Exception during request handling.
Traceback (most recent call last):
File "/odoo/src/odoo/http.py", line 1998, in __call__
response = request._serve_db()
File "/odoo/src/odoo/http.py", line 1584, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/odoo/src/odoo/service/model.py", line 133, in retrying
result = func()
File "/odoo/src/odoo/http.py", line 1611, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/odoo/src/odoo/http.py", line 1818, in dispatch
return self._response(result)
File "/odoo/src/odoo/http.py", line 1854, in _response
return self.request.make_json_response(response)
File "/odoo/src/odoo/http.py", line 1438, in make_json_response
data = json.dumps(data, ensure_ascii=False, default=date_utils.json_default)
File "/usr/lib/python3.9/json/__init__.py", line 234, in dumps
return cls(
File "/usr/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
TypeError: keys must be str, int, float, bool or None, not frozendict So it is a bug on Odoo side, in fact this type of field is still in development, and today it can be used only internally in Odoo code but cannot be used on a view for instance (try to display this field on any Still, this Odoo bug is blocking you because you are requesting all fields when using Mod = odoo.env['account.move.line']
fields = list(Mod._columns) # Get all fields of 'account.move.line'
fields.remove("compute_all_tax") # Remove the buggy field
records = Mod.search_read(fields,[], limit=5) As it is not a bug tied to OdooRPC, I'm closing the issue. Have a good day, |
Module
The name of the module that has a bug.
odoorpc
Describe the bug
odoorpc is not able to manage jsonfield in v16
To Reproduce
Affected versions:
16.0
Steps to reproduce the behavior:
1.odoo = odoorpc.ODOO(url, port=port)
2.odoo.login(database, user, psw)
3.Mod = odoo.env['account.move.line']
4.records = Mod.search_read([],[], limit=5)
because the analytic_distribution field (json field) we have an exception:
keys must be str, int, float, bool or None, not frozendict
Also, i have try with the "read" method, obviously we have the same ;)
# ids = Mod.search_read(domain, ['id'], limit=limit)
# ids = [elem['id'] for elem in ids]
# records = odoo.execute(Mod._name, 'read', ids)
Expected behavior
We expect a stringify json value for analytic_distribution ....
The text was updated successfully, but these errors were encountered: