def cargarviewadhlam(self): self.modeladhlam = QtSql.QSqlTableModel(self) self.modeladhlam.setTable("adhesivo_laminacion") listaref = self.cadenadereferencias(DAO.AdhLamFicha().leerAdhLamFicha( self.edicion)) self.modeladhlam.setFilter("idAdhLam in {0}".format(listaref)) self.modeladhlam.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit) self.modeladhlam.select() self.ui.viewAdhLam.setModel(self.modeladhlam) self.ui.viewAdhLam.hideColumn(0) pass
def deleteRecordsAdhlam(self): try: fila = [] for col in range(self.modeladhlam.columnCount()): index = self.modeladhlam.index( self.ui.viewAdhLam.currentIndex().row(), col) fila.append(str(self.modeladhlam.data(index).toString())) alf = DTO.AdhesivoLaminacion() alf.setIdAdhLam(fila[0]) DAO.AdhLamFicha().eliminarReferencia(fila[0], self.edicion) DAO.AdhesivoLaminacion(alf).eliminarAdhLam() except Exception as e: MostrarError(str(e.message)) else: self.modeladhlam.submitAll()
def insertRecordsAdhlam(self): try: adhlam = DTO.AdhesivoLaminacion() adhlam.setProveedor(self.ui.leProveedorAdhLamMod.text()) adhlam.setAnilox(self.ui.leAniloxAdhLamMod.text()) DAO.AdhesivoLaminacion(adhlam).ingresarAdhLam() "crear referencia de forma inmediata" alf = DAO.AdhLamFicha() alf.setIdFicha(self.edicion) alf.setIdAdhLam(DAO.AdhesivoLaminacion().idUltimoAdhLam()) alf.insertarAdhLamFicha() self.cargarviewadhlam() except Exception as e: MostrarError(str(e.message)) else: self.modeladhlam.submitAll()