this is my create methode to limit the numer of task depending on the kanban state but its not workin it says internal server error
can some one help with a working script please
this is mine
@api.model
def create(self, vals):
# context: no_log, because subtype already handle this
context = dict(self.env.context, mail_create_nolog=True)
# for default stage
if vals.get('project_id') and not context.get('default_project_id'):
context['default_project_id'] = vals.get('project_id')
# user_id change: update date_assign
if vals.get('user_id'):
vals['date_assign'] = fields.Datetime.now()
# ajout
print 'le user la est',self.env.uid
task_ids = self.env['project.task'].search([('project_id', '=', vals.get('project_id')),('user_id', '=', self.env.uid),('kanban_state', '=', 'normal')])
print 'les projet sont',task_ids,len(task_ids)
if len(task_ids)>5:
raise ValidationError(_('Error ! .'))
# fin ajout
task = super(Task, self.with_context(context)).create(vals)
return task
can you provide server trackback ?
TypeError: Model 'project.project' does not exist in registry.