Skip to content

Instantly share code, notes, and snippets.

@name1984
Created June 25, 2024 16:00
Show Gist options
  • Save name1984/655b1e20bcb1e7c55b1d6fa78070ab7a to your computer and use it in GitHub Desktop.
Save name1984/655b1e20bcb1e7c55b1d6fa78070ab7a to your computer and use it in GitHub Desktop.
error server action
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/tools/safe_eval.py", line 362, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "ir.actions.server(294,)", line 14, in <module>
AttributeError: 'Environment' object has no attribute 'add_todo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 1589, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/odoo/odoo-server/odoo/service/model.py", line 133, in retrying
result = func()
File "/odoo/odoo-server/odoo/http.py", line 1616, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/odoo/odoo-server/odoo/http.py", line 1820, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
result = endpoint(**request.params)
File "/odoo/odoo-server/odoo/http.py", line 697, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/odoo/odoo-server/addons/web/controllers/action.py", line 42, in run
result = action.run()
File "/odoo/odoo-server/odoo/addons/base/models/ir_actions.py", line 668, in run
res = runner(run_self, eval_context=eval_context)
File "/odoo/odoo-server/odoo/addons/base/models/ir_actions.py", line 538, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self)) # nocopy allows to return 'action'
File "/odoo/odoo-server/odoo/tools/safe_eval.py", line 376, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
ValueError: <class 'AttributeError'>: "'Environment' object has no attribute 'add_todo'" while evaluating
"# Available variables:\n# - env: Odoo Environment on which the action is triggered\n# - model: Odoo Model of the record on which the action is triggered; is a void recordset\n# - record: record on which the action is triggered; may be void\n# - records: recordset of all records on which the action is triggered in multi-mode; may be void\n# - time, datetime, dateutil, timezone: useful Python libraries\n# - float_compare: Odoo function to compare floats based on specific precisions\n# - log: log(message, level='info'): logging function to record debug information in ir.logging table\n# - UserError: Warning Exception to use with raise\n# - Command: x2Many commands namespace\n# To return an action, assign: action = {...}\n\n\nenv.add_todo(record.move_line_ids._fields['item_available_amount'], record.move_line_ids.search([]))\nrecord.move_line_ids.recompute()"
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
RPCError@http://192.170.100.121:8069/web/assets/6210-b5847db/web.assets_backend.min.js:991:274
makeErrorFromResponse@http://192.170.100.121:8069/web/assets/6210-b5847db/web.assets_backend.min.js:995:163
jsonrpc/promise</<@http://192.170.100.121:8069/web/assets/6210-b5847db/web.assets_backend.min.js:1003:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment