Quellcode durchsuchen

invoice id instead of partn id in rename

deeejas vor 7 Monaten
Ursprung
Commit
db0597137c
1 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. 4 2
      tests/test_anafoauth.py

+ 4 - 2
tests/test_anafoauth.py

@@ -136,6 +136,8 @@ class efactTest(unittest.TestCase):
                     # print(os.path.join(root_f, file))
                     tree = etree.parse(os.path.join(root_f, file))
                     root = tree.getroot()
+                    inv_id = root.xpath('//cbc:ID', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
+                    inv_id = inv_id[0].text
                     parties = root.xpath('//cbc:RegistrationName', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
                     for partie in parties:
                         parent_p_type = partie.getparent().getparent().getparent()
@@ -153,8 +155,8 @@ class efactTest(unittest.TestCase):
                         # print(parent_t_type)
                         if etree.QName(parent_t_type).localname == 'PartyTaxScheme' and etree.QName(parent_p_type).localname == account:  # @UndefinedVariable
                             # print(partie_id.text)
-                            file_id = partie_id.text
-                    new_name = '{}_{}_{}_{}.xml'.format(file.replace('.xml', ''), file_id, file_partie, is_date)
+                            file_partn_id = partie_id.text
+                    new_name = '{}_{}_{}_{}.xml'.format(file.replace('.xml', ''), inv_id, file_partie, is_date)
                     current_path = os.path.join(root_f, file)
                     new_path = os.path.join(root_f, new_name)
                     #