Reputation: 345
I have a problem in odoo 18: I want to move Activity into page tab, but when I try to create or update, I get an error like this:
How can I fix this?
This is my model:
from odoo import models, fields
class Lead(models.Model):
_inherit = "crm.lead"
models_id = fields.Integer(lambda self: self._get_model_id())
def _get_model_id(self):
ir_model = self.env['ir.model'].search([('model', '=', 'crm.lead')], limit=1)
if not ir_model:
raise ValueError("Could not find the 'crm.lead' model in ir.model.")
return ir_model.id
And this is my XML code:
<xpath expr="//page[@name='lead']" position="after">
<page name="activity" string="Activity">
<field name="activity_ids" widget="one2many_list" context="{'default_res_model_id': models_id }">
<list>
<field name="activity_type_id" string="Type"/>
<field name="summary" string="Deskription"/>
<field name="date_deadline" string="Planned Start Date"/>
<field name="state" string="Status"/>
</list>
</field>
</page>
</xpath>
Upvotes: 0
Views: 16