From 806e9ad8d05b9719bc7efa1b22b9c46ae984038a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 2 Mar 2022 10:56:31 +0100 Subject: [PATCH] fix bug #2840 about trade without confirm and with code --- ereuse_devicehub/inventory/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index d8677dd2..c216a4b6 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -822,7 +822,6 @@ class TradeForm(NewActionForm): self.user_from = g.user self.user_to = self.get_or_create_user(code) - return # Create supplier (from) phantom account if not user_from and user_to: @@ -831,6 +830,9 @@ class TradeForm(NewActionForm): self.user_from = self.get_or_create_user(code) self.user_to = g.user + self.db_user_to = self.user_to + self.db_user_from = self.user_from + def get_or_create_user(self, code): email = "{}_{}@dhub.com".format(str(g.user.id), code) user = User.query.filter_by(email=email).first()