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.

46 lines
1.2 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. from odoo import _
  5. from odoo.fields import Date
  6. def date_validator(field, value, error):
  7. try:
  8. Date.from_string(value)
  9. except ValueError as e:
  10. return error(
  11. field, _("{} does not match format '%Y-%m-%d'".format(value))
  12. )
  13. S_SUBSCRIPTION_REQUEST = {
  14. "id": {"type": "integer"},
  15. "name": {"type": "string"},
  16. "email": {"type": "string"},
  17. "date": {"type": "string"},
  18. "ordered_parts": {"type": "integer"},
  19. "share_product": {
  20. "type": "dict",
  21. "schema": {"id": {"type": "integer"}, "name": {"type": "string"}},
  22. },
  23. "address": {
  24. "type": "dict",
  25. "schema": {
  26. "street": {"type": "string"},
  27. "zip_code": {"type": "string"},
  28. "city": {"type": "string"},
  29. "country": {"type": "string"},
  30. },
  31. },
  32. "lang": {"type": "string"},
  33. }
  34. S_SUBSCRIPTION_REQUEST_LIST = {
  35. "count": {"type": "integer"},
  36. "rows": {
  37. "type": "list",
  38. "schema": {"type": "dict", "schema": S_SUBSCRIPTION_REQUEST},
  39. },
  40. }