def add_empresa(self): name = False rfc = False if self.txt_name.text(): name = self.txt_name.text() if self.txt_rfc.text(): rfc = self.txt_rfc.text() if not name or not rfc: print('Debe Insertar un Nombre y RFC.') else: e = Empresa.find_by_rfc(rfc) if e: print('Ya existe una empresa con ese RFC.') else: e = Empresa(rfc=rfc, name=name) print('Agregando {}, {}'.format(name, rfc)) e.save_to_db()
def edit_empresa(self): rfc_empresa = self.tbl_empresas.item(self.tbl_empresas.currentRow(), 1).text() e = Empresa.find_by_rfc(rfc_empresa) self.controller.show_emp_fiel_window(e)
def delete_empresa(self): for current in self.tbl_empresas.selectedItems(): rfc_empresa = self.tbl_empresas.item(current.row(), 1).text() e = Empresa.find_by_rfc(rfc_empresa) e.delete() self.load_data()