Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1702 Weergaven


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
Annuleer
Auteur Beste antwoord

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
Annuleer

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.

Beste antwoord

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
jan. 25
2304
1
dec. 24
6017
1
nov. 24
2436
1
nov. 24
1824
1
aug. 24
3368