Skip to Content
Menu
This question has been flagged
1 Reply
2117 Views

Dear,

I create a model that inherit mail: 

```_inherit = ['mail.thread', 'mail.activity.mixin']```


And then I override write method to schedule an activity on condition:

```

def write(self, vals): 

for rec in self: 

vals = self._prepare_params_for_update(vals, rec)
if vals['has_problem']: 

act_type_id = self.env['mail.activity.type'].search( [('name', 'ilike', 'Record Has Problems')], limit=1).id self.env['mail.activity'].create({ 

 'res_model_id': self.env.ref( < my_model_id > ).id, 

 'res_id': rec.id, 

 'user_id': rec.user_id.id, 

 'activity_type_id': act_type_id, 

 'date_deadline': vals['date_submitted'], 

 }) 

 return super(ChecklistRecord, self).write(vals)

```


But it generates an infinite loop.

I don't know why. Could you guys please help me?


Thanks


Avatar
Discard

hey tran have you got solution for it ?