You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.4 KiB

  1. # Copyright 2020 Coop IT Easy SCRL fs
  2. # Robin Keunen <robin@coopiteasy.be>
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  4. import json
  5. from odoo.fields import Date
  6. def dict_to_dump(content):
  7. return json.dumps(content).encode("utf-8")
  8. NOT_FOUND_ERROR = {"name": "Not Found", "code": 404}
  9. FORBIDDEN_ERROR = {"name": "Forbidden", "code": 403}
  10. SERVER_ERROR = {"name": "Server Error", "code": 500}
  11. NO_RESULT = {"count": 0, "rows": []}
  12. SR_SEARCH_RESULT = {
  13. "count": 1,
  14. "rows": [
  15. {
  16. "id": 1,
  17. "date": "2020-05-14",
  18. "email": "manuel@demo.net",
  19. "address": {
  20. "city": "Brussels",
  21. "street": "schaerbeekstraat",
  22. "zip_code": "1111",
  23. "country": "BE",
  24. },
  25. "lang": "en_US",
  26. "ordered_parts": 3,
  27. "name": "Manuel Dublues",
  28. "share_product": {"name": "Part B - Worker", "id": 31},
  29. "state": "draft",
  30. }
  31. ],
  32. }
  33. SR_GET_RESULT = {
  34. "id": 1,
  35. "name": "Robin Des Bois",
  36. "date": "2020-05-14",
  37. "email": "manuel@demo.net",
  38. "address": {
  39. "city": "Brussels",
  40. "street": "schaerbeekstraat",
  41. "zip_code": "1111",
  42. "country": "BE",
  43. },
  44. "lang": "en_US",
  45. "ordered_parts": 3,
  46. "share_product": {"name": "Part B - Worker", "id": 31},
  47. "state": "draft",
  48. }
  49. SR_VALIDATE_RESULT = {
  50. "id": 9999,
  51. "number": "SUBJ/2020/001",
  52. "date_due": "2020-08-12",
  53. "state": "open",
  54. "date_invoice": "2020-08-12",
  55. "date": "2020-08-12",
  56. "type": "out_invoice",
  57. "subscription_request": {"name": "Manuel Dublues", "id": 1},
  58. "partner": {"name": "Manuel Dublues", "id": 1},
  59. "invoice_lines": [
  60. {
  61. "price_unit": 25.0,
  62. "quantity": 3.0,
  63. "account": {"name": "Product Sales", "id": 2},
  64. "name": "Part B - Worker",
  65. "product": {"name": "Part B - Worker", "id": 2},
  66. }
  67. ],
  68. "journal": {"name": "Subscription Journal", "id": 1},
  69. "account": {"name": "Cooperators", "id": 1},
  70. }
  71. AP_CREATE_RESULT = {
  72. "id": 9876,
  73. "journal": {"id": 1, "name": "bank"},
  74. "invoice": {
  75. "id": SR_VALIDATE_RESULT["id"],
  76. "name": SR_VALIDATE_RESULT["number"],
  77. },
  78. "payment_date": Date.to_string(Date.today()),
  79. "amount": 75.0,
  80. "communication": SR_VALIDATE_RESULT["number"],
  81. }