Merge branch 'develop'
Fix - Formato de celdas en conceptos
This commit is contained in:
commit
03ac074c66
|
@ -611,6 +611,9 @@ class LIBO(object):
|
||||||
'-env:SingleAppInstance=false',
|
'-env:SingleAppInstance=false',
|
||||||
'-env:UserInstallation=file:///tmp/LIBO_Process8100',
|
'-env:UserInstallation=file:///tmp/LIBO_Process8100',
|
||||||
'--headless', '--norestore', '--nologo', '--accept={}'.format(ARG)]
|
'--headless', '--norestore', '--nologo', '--accept={}'.format(ARG)]
|
||||||
|
CELL_STYLE = {
|
||||||
|
'EUR': 'euro',
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._app = None
|
self._app = None
|
||||||
|
@ -622,6 +625,7 @@ class LIBO(object):
|
||||||
self._ctx = None
|
self._ctx = None
|
||||||
self._sm = None
|
self._sm = None
|
||||||
self._desktop = None
|
self._desktop = None
|
||||||
|
self._currency = 'MXN'
|
||||||
if self.is_running:
|
if self.is_running:
|
||||||
ctx = uno.getComponentContext()
|
ctx = uno.getComponentContext()
|
||||||
service = 'com.sun.star.bridge.UnoUrlResolver'
|
service = 'com.sun.star.bridge.UnoUrlResolver'
|
||||||
|
@ -816,6 +820,17 @@ class LIBO(object):
|
||||||
dispatch.executeDispatch(frame, '.uno:Paste', '', 0, ())
|
dispatch.executeDispatch(frame, '.uno:Paste', '', 0, ())
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def _get_style(self, cell):
|
||||||
|
if cell is None:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
match = re.match(r"([a-z]+)([0-9]+)", cell.CellStyle, re.I)
|
||||||
|
if not match:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
currency = self.CELL_STYLE.get(self._currency, 'peso')
|
||||||
|
return '{}{}'.format(currency, match.groups()[1])
|
||||||
|
|
||||||
def _conceptos(self, data):
|
def _conceptos(self, data):
|
||||||
first = True
|
first = True
|
||||||
col1 = []
|
col1 = []
|
||||||
|
@ -825,7 +840,7 @@ class LIBO(object):
|
||||||
col5 = []
|
col5 = []
|
||||||
col6 = []
|
col6 = []
|
||||||
col7 = []
|
col7 = []
|
||||||
count = len(data)-1
|
count = len(data) - 1
|
||||||
for concepto in data:
|
for concepto in data:
|
||||||
key = concepto.get('noidentificacion', '')
|
key = concepto.get('noidentificacion', '')
|
||||||
description = concepto['descripcion']
|
description = concepto['descripcion']
|
||||||
|
@ -860,6 +875,10 @@ class LIBO(object):
|
||||||
if not count:
|
if not count:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
style_5 = self._get_style(cell_5)
|
||||||
|
style_6 = self._get_style(cell_6)
|
||||||
|
style_7 = self._get_style(cell_7)
|
||||||
|
|
||||||
col = cell_1.getCellAddress().Column
|
col = cell_1.getCellAddress().Column
|
||||||
target1 = self._sheet.getCellRangeByPosition(col, row+1, col, row+count)
|
target1 = self._sheet.getCellRangeByPosition(col, row+1, col, row+count)
|
||||||
col = cell_2.getCellAddress().Column
|
col = cell_2.getCellAddress().Column
|
||||||
|
@ -872,6 +891,10 @@ class LIBO(object):
|
||||||
target5 = self._sheet.getCellRangeByPosition(col, row+1, col, row+count)
|
target5 = self._sheet.getCellRangeByPosition(col, row+1, col, row+count)
|
||||||
col = cell_6.getCellAddress().Column
|
col = cell_6.getCellAddress().Column
|
||||||
target6 = self._sheet.getCellRangeByPosition(col, row+1, col, row+count)
|
target6 = self._sheet.getCellRangeByPosition(col, row+1, col, row+count)
|
||||||
|
target7 = None
|
||||||
|
if not cell_7 is None:
|
||||||
|
col = cell_7.getCellAddress().Column
|
||||||
|
target7 = self._sheet.getCellRangeByPosition(col, row+1, col, row+count)
|
||||||
|
|
||||||
target1.setFormulaArray(tuple(col1))
|
target1.setFormulaArray(tuple(col1))
|
||||||
target2.setDataArray(tuple(col2))
|
target2.setDataArray(tuple(col2))
|
||||||
|
@ -879,6 +902,18 @@ class LIBO(object):
|
||||||
target4.setDataArray(tuple(col4))
|
target4.setDataArray(tuple(col4))
|
||||||
target5.setDataArray(tuple(col5))
|
target5.setDataArray(tuple(col5))
|
||||||
target6.setDataArray(tuple(col6))
|
target6.setDataArray(tuple(col6))
|
||||||
|
if not target7 is None:
|
||||||
|
target7.setDataArray(tuple(col7))
|
||||||
|
|
||||||
|
if style_5:
|
||||||
|
cell_5.CellStyle = style_5
|
||||||
|
target5.CellStyle = style_5
|
||||||
|
if style_6:
|
||||||
|
cell_6.CellStyle = style_6
|
||||||
|
target6.CellStyle = style_6
|
||||||
|
if style_7:
|
||||||
|
cell_7.CellStyle = style_7
|
||||||
|
target7.CellStyle = style_7
|
||||||
return
|
return
|
||||||
|
|
||||||
def _add_totales(self, data):
|
def _add_totales(self, data):
|
||||||
|
@ -1098,6 +1133,8 @@ class LIBO(object):
|
||||||
self._set_search()
|
self._set_search()
|
||||||
self._es_pre = data.pop('es_pre', False)
|
self._es_pre = data.pop('es_pre', False)
|
||||||
self._is_ticket = data.pop('is_ticket', False)
|
self._is_ticket = data.pop('is_ticket', False)
|
||||||
|
self._currency = data['totales']['moneda']
|
||||||
|
|
||||||
self._comprobante(data['comprobante'])
|
self._comprobante(data['comprobante'])
|
||||||
self._emisor(data['emisor'])
|
self._emisor(data['emisor'])
|
||||||
self._receptor(data['receptor'])
|
self._receptor(data['receptor'])
|
||||||
|
|
|
@ -8182,9 +8182,10 @@ def _exportar_documentos():
|
||||||
msg = '\tXML extraido...'
|
msg = '\tXML extraido...'
|
||||||
log.info(msg)
|
log.info(msg)
|
||||||
name = name[:-3] + 'pdf'
|
name = name[:-3] + 'pdf'
|
||||||
# ~ path = '/home/mau/facturas/CURG62080951A/{}/{}/{}'.format(year, month.zfill(2), name)
|
path = '/home/mau/facturas/{}/{}/{}/{}'.format(
|
||||||
# ~ if util.exists(path):
|
rfc, year, month.zfill(2), name)
|
||||||
# ~ continue
|
if util.exists(path):
|
||||||
|
continue
|
||||||
Facturas.get_pdf(row['id'], rfc, True)
|
Facturas.get_pdf(row['id'], rfc, True)
|
||||||
msg = '\tPDF generado...'
|
msg = '\tPDF generado...'
|
||||||
log.info(msg)
|
log.info(msg)
|
||||||
|
|
Loading…
Reference in New Issue