fix bug #2840 about trade without confirm and with code

This commit is contained in:
Cayo Puigdefabregas 2022-03-02 10:56:31 +01:00
parent 15d913efea
commit 806e9ad8d0
1 changed files with 3 additions and 1 deletions

View File

@ -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()