Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
1680 Представления


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()

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
янв. 25
2296
1
дек. 24
6008
1
нояб. 24
2428
1
нояб. 24
1822
1
авг. 24
3362