Pārlūkot izejas kodu

reconfigure directory structure

year, month are now first
deeejas 7 mēneši atpakaļ
vecāks
revīzija
1002032474
2 mainītis faili ar 34 papildinājumiem un 29 dzēšanām
  1. 28 26
      .gitignore
  2. 6 3
      anafapi/anafoauth.py

+ 28 - 26
.gitignore

@@ -421,31 +421,31 @@ _Pvt_Extensions
 
 
 # ---> macOS
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Icon must end with two \r
-Icon
-
-
-# Thumbnails
-._*
-
-# Files that might appear in the root of a volume
-.DocumentRevisions-V100
-.fseventsd
-.Spotlight-V100
-.TemporaryItems
-.Trashes
-.VolumeIcon.icns
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
 
 /test_token.json
 *zip
@@ -454,4 +454,6 @@ Temporary Items
 *.XML
 /*.xml
 /*.XML
-config.ini
+*.pdf
+/*.pdf
+config.ini

+ 6 - 3
anafapi/anafoauth.py

@@ -199,15 +199,18 @@ class Efactoauth(Anafoauth):
                     cif_ben = 'cif_ben erro'
                 type_ = inv['tip']
                 print(index_, date_, cif, type_)
-                dir_dates = '{:02d}_{}'.format(date_.month, date_.year)
+                # dir_dates = '{:02d}_{}'.format(date_.month, date_.year)
+                dir_dates = '{}_{:02d}'.format(date_.year, date_.month)
                 dir_cifs = '{}'.format(cif)
                 dir_cifs_ben = '{}'.format(cif_ben)
                 dir_types = type_
                 dir_days = '{:02d}'.format(date_.day)
                 if type_ == 'FACTURA TRIMISA':
-                    dirs = os.path.join(root_path, dir_cifs, dir_types, dir_dates, dir_days, dir_cifs_ben)
+                    # dirs = os.path.join(root_path, dir_cifs, dir_types, dir_dates, dir_days, dir_cifs_ben)
+                    dirs = os.path.join(root_path, dir_types, dir_dates, dir_cifs, dir_days, dir_cifs_ben)
                 else:
-                    dirs = os.path.join(root_path, dir_cifs, dir_types, dir_dates, dir_days)
+                    # dirs = os.path.join(root_path, dir_cifs, dir_types, dir_dates, dir_days)
+                    dirs = os.path.join(root_path, dir_types, dir_dates, dir_cifs, dir_days)
                 # print(dirs)
                 os.makedirs(dirs, exist_ok=True)
                 new = self.download_invoice(download_id=inv['id'], path=dirs, env=env)