Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
1705 Zobrazení


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'

Avatar
Zrušit
Autor Nejlepší odpověď

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!

Avatar
Zrušit

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.

Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
led 25
2310
1
pro 24
6021
1
lis 24
2438
1
lis 24
1830
1
srp 24
3374