跳至內容
選單
此問題已被標幟
2 回覆
141 瀏覽次數

Hello, I usually manage to get by, just using the search but I'm a bit stumped this time. I would appreciate some pointers in to the right direction.

Recently, I've been made aware of crashing/errors occurring during the following:
1. Updating the country field in Contacts, when the contact had no prior entry in the country field.
It crashes on save and produces the following stack trace.

Trace: 
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/http.py", line 1971, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 154, in retrying env.cr.flush() # submit the changes to the database ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 138, in flush self.precommit.run() File "/usr/lib/python3/dist-packages/odoo/tools/misc.py", line 1227, in run func() File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 530, in _track_finalize tracking = records.with_context(context)._message_track(fnames, initial_values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 612, in _message_track tracking[record.id] = record._mail_track(tracked_fields, initial_values_dict[record.id]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/models.py", line 154, in _mail_track [0, 0, self.env['mail.tracking.value']._create_tracking_values( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_tracking_value.py", line 93, in _create_tracking_values 'new_value_char': new_value and dict(col_info['selection'])[new_value] or '' ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ KeyError: '0218' The above server error caused the following client error: RPC_ERROR: Odoo Server Error

2. When changing the stage of a CRM lead.

Stack trace:
RPC_ERROR Odoo Server Error Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/http.py", line 1971, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 154, in retrying env.cr.flush() # submit the changes to the database ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 138, in flush self.precommit.run() File "/usr/lib/python3/dist-packages/odoo/tools/misc.py", line 1227, in run func() File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 530, in _track_finalize tracking = records.with_context(context)._message_track(fnames, initial_values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 636, in _message_track record.message_post( File "/usr/lib/python3/dist-packages/odoo/addons/sms/models/mail_thread.py", line 52, in message_post return super().message_post(*args, body=body, message_type=message_type, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/rating/models/mail_thread.py", line 178, in message_post message = super(MailThread, self).message_post(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 2223, in message_post new_message = self._message_create([msg_values]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/rating/models/mail_thread.py", line 34, in _message_create return super()._message_create(values_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 2912, in _message_create ).create(create_values_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-61>", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 431, in _model_create_multi return create(self, arg) ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_message.py", line 687, in create vals_lst = [dict(cmd[2], mail_message_id=message.id) for cmd in tracking_values_cmd if len(cmd) == 3 and cmd[0] == 0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_message.py", line 687, in <listcomp> vals_lst = [dict(cmd[2], mail_message_id=message.id) for cmd in tracking_values_cmd if len(cmd) == 3 and cmd[0] == 0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable The above server error caused the following client error: RPC_ERROR: Odoo Server Error

3. (Speculation) I suspect that there is some common root cause and there might be other occasions, where it might result in crashing.


It seems that the common theme is "tracking values", but I'm not sure where I should be looking in to next.

Thanks for reading, any help would be greatly appreciated.

頭像
捨棄
最佳答案

Hi,


The issue you’re encountering in Odoo is related to the mail tracking system, which records changes made to fields and displays them in the chatter. The error occurs when the tracking mechanism tries to log a value that no longer exists or is invalid — for instance, when updating the country field or changing the CRM lead stage. Specifically, the first error (KeyError: '0218') indicates that a tracked selection field (like the country) has a value that is not found in the selection mapping, possibly due to data inconsistency or a missing country code.


In the second case, the 'NoneType' object is not iterable error happens when _message_post() tries to process tracking values that are None. This usually points to a corrupted or incomplete tracking value being generated when changes occur in models inheriting from mail.thread. Both errors suggest that the mail tracking logic is receiving unexpected or broken data during record updates.


To resolve this, you should first check for data inconsistencies in the affected models, particularly in selection fields like country_id or custom tracking-enabled fields. Review any custom modules that override _message_track() or _mail_track() and ensure they handle None and missing values safely. Also, confirm that mail tracking is correctly configured — meaning all tracked fields have valid selection mappings and that no invalid foreign keys exist. If necessary, you can temporarily disable tracking on problematic fields to confirm the root cause.


In summary, the root of your crashes is likely data corruption or an invalid tracked value, causing the mail tracking subsystem to fail. Cleaning up data and verifying tracking field configurations should prevent these errors.


Hope it helps

頭像
捨棄
最佳答案

Hi,
As a generic suggestion on this, can you ensure you are using the latest version of v17 and no custom modules causing this issue ?

Thanks

頭像
捨棄