Couple of API tweaks for work orders
made a change to sorting such that it assumes the primary model is being sorted, if caller does not specify
This commit is contained in:
parent
8d70107b5d
commit
4c29a667cb
2 changed files with 11 additions and 8 deletions
|
@ -66,6 +66,12 @@ class WorkOrderView(APIMasterView):
|
|||
'date_delivered': six.text_type(workorder.date_delivered or ''),
|
||||
}
|
||||
|
||||
def create_object(self, data):
|
||||
|
||||
# invoke the handler instead of normal API CRUD logic
|
||||
workorder = self.workorder_handler.make_workorder(self.Session(), **data)
|
||||
return workorder
|
||||
|
||||
def update_object(self, workorder, data):
|
||||
date_fields = [
|
||||
'date_submitted',
|
||||
|
@ -79,7 +85,7 @@ class WorkOrderView(APIMasterView):
|
|||
if field in data:
|
||||
if data[field] == '':
|
||||
data[field] = None
|
||||
else:
|
||||
elif not isinstance(data[field], datetime.date):
|
||||
date = datetime.datetime.strptime(data[field], '%Y-%m-%d').date()
|
||||
data[field] = date
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue