'This function is called at the time of analytic account creation and is used to create a project automatically linked to it if the conditions are meet.'

@api.multi
def project_create(self, vals):

    self.ensure_one()
    Project = self.env['project.project']
    project = Project.with_context(active_test=False).search([('analytic_account_id', '=', self.id)])
    if ((not project) and self._trigger_project_creation(vals)):
        project_values = {'name': vals.get('name'), 'analytic_account_id': self.id, 'use_tasks': True}
        return Project.create(project_values).id
    return False
