forked from elmau/empresa-libre
Refactory generate files
This commit is contained in:
parent
aae856bb74
commit
56e52782f4
|
@ -2752,7 +2752,7 @@ def sync_files(files, auth={}):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def sync_cfdi(rfc, files):
|
def sync_cfdi(files):
|
||||||
local_copy(files)
|
local_copy(files)
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
|
|
@ -521,7 +521,6 @@ class Configuracion(BaseModel):
|
||||||
user = cls.get_(f'user_timbrado_{pac}')
|
user = cls.get_(f'user_timbrado_{pac}')
|
||||||
token = cls.get_(f'token_timbrado_{pac}')
|
token = cls.get_(f'token_timbrado_{pac}')
|
||||||
data = {}
|
data = {}
|
||||||
print(1, pac, user, token)
|
|
||||||
if pac and user and token:
|
if pac and user and token:
|
||||||
data['pac'] = pac
|
data['pac'] = pac
|
||||||
data['user'] = user
|
data['user'] = user
|
||||||
|
@ -4268,23 +4267,22 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
@util.run_in_thread
|
@util.run_in_thread
|
||||||
def _sync_pdf(self, pdf, name_pdf, target):
|
def _sync_pdf(self, pdf, name_pdf, target):
|
||||||
auth = Emisor.get_auth()
|
# ~ auth = Emisor.get_auth()
|
||||||
files = (
|
files = (
|
||||||
(pdf, name_pdf, target),
|
(pdf, name_pdf, target),
|
||||||
)
|
)
|
||||||
util.sync_cfdi(auth, files)
|
util.sync_cfdi(files)
|
||||||
return
|
return
|
||||||
|
|
||||||
@util.run_in_thread
|
@util.run_in_thread
|
||||||
def _sync_xml(self, obj):
|
def _sync_xml(self, obj):
|
||||||
emisor = Emisor.select()[0]
|
emisor = Emisor.select()[0]
|
||||||
auth = Emisor.get_auth()
|
|
||||||
name_xml = '{}{}_{}.xml'.format(obj.serie, obj.folio, obj.cliente.rfc)
|
name_xml = '{}{}_{}.xml'.format(obj.serie, obj.folio, obj.cliente.rfc)
|
||||||
target = emisor.rfc + '/' + str(obj.fecha)[:7].replace('-', '/')
|
target = emisor.rfc + '/' + str(obj.fecha)[:7].replace('-', '/')
|
||||||
files = (
|
files = (
|
||||||
(obj.xml, name_xml, target),
|
(obj.xml, name_xml, target),
|
||||||
)
|
)
|
||||||
util.sync_cfdi(auth, files)
|
util.sync_cfdi(files)
|
||||||
return
|
return
|
||||||
|
|
||||||
@util.run_in_thread
|
@util.run_in_thread
|
||||||
|
@ -4377,7 +4375,7 @@ class Facturas(BaseModel):
|
||||||
(obj.xml, name_xml, target),
|
(obj.xml, name_xml, target),
|
||||||
(pdf, name_pdf, target),
|
(pdf, name_pdf, target),
|
||||||
)
|
)
|
||||||
util.sync_cfdi(rfc, files)
|
util.sync_cfdi(files)
|
||||||
return
|
return
|
||||||
|
|
||||||
def _get_filter_folios(self, values):
|
def _get_filter_folios(self, values):
|
||||||
|
@ -5783,7 +5781,7 @@ class PreFacturas(BaseModel):
|
||||||
files = (
|
files = (
|
||||||
(doc, name, target),
|
(doc, name, target),
|
||||||
)
|
)
|
||||||
util.sync_cfdi({'REPO': False}, files)
|
util.sync_cfdi(files)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue