marton levente 4 місяців тому
батько
коміт
1c53d03176
2 змінених файлів з 6 додано та 4 видалено
  1. 2 0
      anafapi/en16931/invoice_line.py
  2. 4 4
      anafapi/en16931/xpaths.py

+ 2 - 0
anafapi/en16931/invoice_line.py

@@ -43,6 +43,8 @@ UNIT_CODES = {
     'E48': 'Service unit'
 }
 
+# CATEGORIES = {'AE', 'L', 'M', 'E', 'S', 'Z', 'G', 'O', 'K'}
+TAX_MAP = {'S': 1, 'E': 3, 'AE': 4, 'O': 7, 'L': 8, 'M': 9, 'G': 6, 'K': 5, 'Z': 2}
 
 class InvoiceLine:
     """EN16931 InvoiceLine class.

+ 4 - 4
anafapi/en16931/xpaths.py

@@ -107,7 +107,7 @@ def get_from_xpath(root, tag, xpaths=None, namespaces=None):
     result = root.xpath(xpath, namespaces=namespaces)
     if not result:
         return None
-    text_result = [e.text if isinstance(e, lxml.etree._Element) else e for e in result]
+    text_result = [e.text if isinstance(e, lxml.etree._Element) else e for e in result]  # @UndefinedVariable
     return ", ".join(text_result)
 
 
@@ -116,7 +116,7 @@ def get_namespaces():
     """
     global namespaces
     if namespaces is None:
-        #print("loading namespace")
+        # print("loading namespace")
         namespaces = en16931_namespaces()
     return namespaces
 
@@ -137,7 +137,7 @@ def get_xpaths():
     """
     global xpaths
     if xpaths is None:
-        #print("loading xpaths")
+        # print("loading xpaths")
         xpaths = en16931_xpaths()
     return xpaths
 
@@ -250,7 +250,7 @@ def en16931_xpaths():
     xpaths["ponumber"] = "/xmlns:Invoice/cac:OrderReference/cbc:ID"
     xpaths["contract_number"] = "/xmlns:Invoice/cac:ContractDocumentReference/cbc:ID"
     # relative to invoice_lines/discounts
-    #xpaths["line_discount_percent"] = "cbc:MultiplierFactorNumeric"
+    # xpaths["line_discount_percent"] = "cbc:MultiplierFactorNumeric"
     xpaths["line_discount_text"] = "cbc:AllowanceChargeReason"
     xpaths["line_discount_amount"] = "cbc:Amount"
     # relative to invoice_lines/charges