Hello Everyone,
I have a model approve.base which is an AbstractModel, and it contains a many2one field workflow_config_id referencing the model workflow.config, which is a Model.
class ApproveBase(models.AbstractModel):
_name = 'approve.base'
workflow_config_id = fields.Many2one('workflow.config', string='Workflow Config',copy=False, tracking=True)
class WorkflowConfig(models.Model):
_name = 'workflow.config'
active = fields.Boolean(string=_('Active'), default=True)
class ModelA(models.Model):
_name = "model.a"
_inherit = ['approve.base']
I then developed a functionality called model A that inherits approve.base. The error occurs when I create a record in model A, where the field workflow_config_id holds a record from workflow.config. Afterward, I use the deactivation function (in workflow.config, there is an active field) to deactivate the referenced record and create a similar record in workflow.config. Next, when I click on that record in model A, the following error occurs:
RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/models.py", line 128, in web_read
vals = many2one_data[values[field_name]]
KeyError: 61
I checked and saw that the KeyError: 61 corresponds to the ID of the workflow.config record that I deactivated. I tried debugging the web_read function and noticed that the workflow_config_id value is now pointing to the new record that I created in the workflow.config model.
If anyone knows what might be causing this and what the solution could be, please help me.
Regards,