Ejemplo n.º 1
0
	def disableButtons(self):
		canAdd = appInst.isAdmin() or appInst.isManager()
		self.ui.addRecordButton.setDisabled(not canAdd)
		canChange = appInst.isAdmin() and len(self.ui.tableWidget.selectedItems())
		if len(self.ui.tableWidget.selectedItems()):
			row = self.ui.tableWidget.currentRow()
			projectEmpolyee = appInst.getRecord('projectEmployees', self.primaryKeys[row])
			canChange = canChange or (appInst.isManagerOnProject(projectEmpolyee.projectId) and\
				projectEmpolyee.employeeId != appInst.getEmployee().id)
		self.ui.editRecordButton.setDisabled(not canChange)
		self.ui.deleteRecordButton.setDisabled(not canChange)
Ejemplo n.º 2
0
	def disableButtons(self):
		canAdd = appInst.isAdmin() or appInst.isManager()
		self.ui.addRecordButton.setDisabled(not canAdd)
		canChange = appInst.isAdmin() and len(self.ui.tableWidget.selectedItems())
		canDelete = False
		if len(self.ui.tableWidget.selectedItems()):
			row = self.ui.tableWidget.currentRow()
			task = appInst.getRecord('tasks', self.primaryKeys[row])
			canDelete = canChange or appInst.isManagerOnProject(task.projectId)
			canChange = canDelete or appInst.isTaskDeveloper(self.primaryKeys[row][0]['value'])
		self.ui.editRecordButton.setDisabled(not canChange)
		self.ui.deleteRecordButton.setDisabled(not canDelete)
Ejemplo n.º 3
0
	def disableButtons(self):
		canAdd = appInst.isAdmin() or appInst.isManager() or\
			appInst.isDeveloper()
		self.ui.addRecordButton.setDisabled(not canAdd)
		canChange = appInst.isAdmin() and len(self.ui.tableWidget.selectedItems())
		if len(self.ui.tableWidget.selectedItems()):
			row = self.ui.tableWidget.currentRow()
			job = appInst.getRecord('jobs', self.primaryKeys[row])
			task = dbi.query(Task).filter(Task.id == job.taskId).one()
			canChange = canChange or appInst.isManagerOnProject(task.projectId) or\
				appInst.isTaskDeveloper(task.id)
		self.ui.editRecordButton.setDisabled(not canChange)
		self.ui.deleteRecordButton.setDisabled(not canChange)
Ejemplo n.º 4
0
	def disableButtons(self):
		canAdd = appInst.isAdmin() and appInst.getMaxTasksNumOnProjects()> 1 or\
			appInst.isManager() and appInst.getMaxTasksNumOnProjectsWithManager() > 1
		self.ui.addRecordButton.setDisabled(not canAdd)
		canChange = appInst.isAdmin() and len(self.ui.tableWidget.selectedItems())
		if len(self.ui.tableWidget.selectedItems()):
			row = self.ui.tableWidget.currentRow()
			taskDependency = appInst.getRecord('tasksDependencies', self.primaryKeys[row])
			project1 = appInst.getProjectByTask(taskDependency.masterId)
			project2 = appInst.getProjectByTask(taskDependency.slaveId)
			canChange = canChange or (appInst.isManagerOnProject(project1.id) and\
				project1.id == project2.id)
		self.ui.editRecordButton.setDisabled(not canChange)
		self.ui.deleteRecordButton.setDisabled(not canChange)