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