您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

51 行
1.1KB

  1. #!/usr/bin/python3
  2. import os, sys, re, time, datetime
  3. import logging
  4. log = logging.getLogger()
  5. from invoice.db.base import *
  6. class Companies(List):
  7. """Company list.
  8. When editing data files, you can use the following directives:
  9. Name -- full company name
  10. Address -- company address, repeat to get multiple lines
  11. ICO -- identification number
  12. DIC -- tax identification number
  13. ICDPH
  14. IBAN
  15. SWIFT
  16. Comment -- additional information that you want to see on the invoice
  17. """
  18. _directory = "companies"
  19. _regex = re.compile("^(?P<name>[a-z0-9-]+)$")
  20. _template = "{name}"
  21. data_template = """\
  22. Name:
  23. Address:
  24. Address:
  25. ICO:
  26. DIC:
  27. ICDPH:
  28. IBAN:
  29. SWIFT:
  30. """
  31. def _item_class(self):
  32. return Company
  33. class Company(Item):
  34. def _data_class(self):
  35. return CompanyData
  36. class CompanyData(Data):
  37. _fields = ["name", "ico", "dic", "icdph", "iban", "swift"]
  38. _multivalue_fields = ["address", "comment"]
  39. def _postprocess(self):
  40. #self.rename_key("ic", "number")
  41. self.rename_key("comment", "comments")