Prevent updates to batch rows, if batch is immutable

probably need a lot more support for this elsewhere; this is all i needed for
the moment though..
This commit is contained in:
Lance Edgar 2021-02-02 18:58:46 -06:00
parent f93fd7aefa
commit 63350469d0
3 changed files with 16 additions and 4 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2020 Lance Edgar
# Copyright © 2010-2021 Lance Edgar
#
# This file is part of Rattail.
#
@ -345,8 +345,12 @@ class APIMasterView(APIView):
# assume our data comes only from request JSON body
data = self.request.json_body
# update and return data for object
# try to update data for object, returning error as necessary
obj = self.update_object(obj, data)
if isinstance(obj, dict) and 'error' in obj:
return {'error': obj['error']}
# return data for object
self.Session.flush()
return self._get(obj)