Merge branch 'feature/server-side-render-actions-trade' of github.com:eReuse/devicehub-teal into feature/server-side-render-actions-trade

This commit is contained in:
Cayo Puigdefabregas 2022-02-22 11:17:39 +01:00
commit eed2849af3

View file

@ -727,9 +727,10 @@ class TradeForm(NewActionForm):
code = self.code.data code = self.code.data
if user_from and user_to: if user_from and user_to:
# both users exist, no further action is necessary
return return
# Creating receiver phantom account # Create receiver (to) phantom account
if user_from and not user_to: if user_from and not user_to:
assert g.user.email == user_from assert g.user.email == user_from
user = self.create_user(code) user = self.create_user(code)
@ -737,7 +738,7 @@ class TradeForm(NewActionForm):
self.user_to = user self.user_to = user
return return
# Creating supplier phantom account # Create supplier (from) phantom account
if not user_from and user_to: if not user_from and user_to:
assert g.user.email == user_to assert g.user.email == user_to
user = self.create_user(code) user = self.create_user(code)