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

# Copyright 2020 Coop IT Easy SCRL fs
# Robin Keunen <robin@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _
from odoo.fields import Date
def date_validator(field, value, error):
try:
Date.from_string(value)
except ValueError as e:
return error(
field, _("{} does not match format '%Y-%m-%d'".format(value))
)
S_SUBSCRIPTION_REQUEST = {
"id": {"type": "integer"},
"name": {"type": "string"},
"email": {"type": "string"},
"date": {"type": "string"},
"ordered_parts": {"type": "integer"},
"share_product": {
"type": "dict",
"schema": {"id": {"type": "integer"}, "name": {"type": "string"}},
},
"address": {
"type": "dict",
"schema": {
"street": {"type": "string"},
"zip_code": {"type": "string"},
"city": {"type": "string"},
"country": {"type": "string"},
},
},
"lang": {"type": "string"},
}
S_SUBSCRIPTION_REQUEST_LIST = {
"count": {"type": "integer"},
"rows": {
"type": "list",
"schema": {"type": "dict", "schema": S_SUBSCRIPTION_REQUEST},
},
}