From d10a7c16416065501516608842417921382523c3 Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Tue, 23 Jan 2018 16:10:22 -0600 Subject: [PATCH] Fix - Issue #143 --- source/app/controllers/util.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 8b9a4f6..72f3b4d 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -678,7 +678,10 @@ class LIBO(object): self._search.EndRow ) self._sd = self._sheet.createSearchDescriptor() - self._sd.SearchCaseSensitive = False + try: + self._sd.SearchCaseSensitive = False + except: + print ('SD', self._sd) return def _next_cell(self, cell): @@ -740,7 +743,6 @@ class LIBO(object): def _conceptos(self, data): first = True - copy = False for concepto in data: key = concepto.get('noidentificacion', '') description = concepto['descripcion'] @@ -756,14 +758,14 @@ class LIBO(object): cell_4 = self._set_cell('{cantidad}', cantidad, value=True) cell_5 = self._set_cell('{valorunitario}', valor_unitario, value=True) cell_6 = self._set_cell('{importe}', importe, value=True) - else: - row = cell_2.getCellAddress().Row + 1 - if not copy: + if len(data) > 1: + row = cell_1.getCellAddress().Row + 1 self._sheet.getRows().insertByIndex(row, len(data)-1) - copy = True - source = self._sheet.getRows().getByIndex(row - 1) + source = self._sheet.getRows().getByIndex(row - 1) + nc = self._next_cell(cell_1) + self._sheet.copyRange(nc.getCellAddress(), source.getRangeAddress()) + else: cell_1 = self._set_cell(v=key, cell=cell_1) - self._sheet.copyRange(cell_1.getCellAddress(), source.getRangeAddress()) cell_2 = self._set_cell(v=description, cell=cell_2) cell_3 = self._set_cell(v=unidad, cell=cell_3) cell_4 = self._set_cell(v=cantidad, cell=cell_4, value=True)