Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion odoo/addons/base/models/ir_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,12 +1425,14 @@ def safe_write(records, fname, value):
records.invalidate_cache([fname])

for selection in self:
Model = self.env[selection.field_id.model]
# The field may exist in database but not in registry. In this case
# we allow the field to be skipped, but for production this should
# be handled through a migration script. The ORM will take care of
# the orphaned 'ir.model.fields' down the stack, and will log a
# warning prompting the developer to write a migration script.
Model = self.env.get(selection.field_id.model)
if Model is None:
continue
field = Model._fields.get(selection.field_id.name)
if not field or not field.store or not Model._auto:
continue
Expand Down