コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
1699 ビュー


Hi, we get AttributeError when pressing a button to change the state of an RFQ in our Odoo system while running this function:

def state_machine_trigger(self, trigger_name):
self.ensure_one()
proxy = Proxy(self, "state")
MACHINE.add_model(proxy, initial=self.state)
try:
proxy.trigger(trigger_name)
except MachineError as e:
_LOGGER.exception(e)
except Exception:
_LOGGER.exception("here be bork")
finally:
MACHINE.remove_model(proxy)





Traceback (most recent call last):
File "/home/odoo/odoo/lib/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/odoo/odoo/lib/odoo/odoo/http.py", line 685, in dispatch
result = self._call_function(**self.params)
File "/home/odoo/odoo/lib/odoo/odoo/http.py", line 361, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/odoo/odoo/lib/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/odoo/lib/odoo/odoo/http.py", line 357, in checked_call
self._cr.precommit.run()
File "/home/odoo/odoo/lib/odoo/odoo/tools/misc.py", line 1165, in run
func()
File "/home/odoo/odoo/lib/odoo/addons/mail/models/mail_thread.py", line 550, in _finalize_tracking
tracking = records.with_context(context).message_track(fnames, initial_values)
File "/home/odoo/odoo/lib/odoo/addons/mail/models/mail_thread.py", line 626, in message_track
if not subtype.exists():
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/odoo/lib/odoo/odoo/http.py", line 641, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/odoo/lib/odoo/odoo/http.py", line 317, in _handle_exception
raise exception.with_traceback(None) from new_cause
AttributeError: 'str' object has no attribute 'exists'

アバター
破棄
著作者 最善の回答

Yeah we discovered that the problem only occurs when adding tracking=True to the field. the subtype.exists() is being called in mail module that tracking uses, how do we fix our field so that we can use tracking? Thanks!

アバター
破棄

Thanks a lot for your answer, it works. I have been trying to migrate an odoo v12 module into v17, and the field parameter tracking_visibility seems to cause this subtype.exists() error.

最善の回答

here subtype.exists()  in subtype you are getting a string value not an object so you cant call subtype.exists()

アバター
破棄
関連投稿 返信 ビュー 活動
2
1月 25
2304
1
12月 24
6017
1
11月 24
2431
1
11月 24
1824
1
8月 24
3366