fix bug #2840 about trade without confirm and with code
This commit is contained in:
parent
15d913efea
commit
806e9ad8d0
|
@ -822,7 +822,6 @@ class TradeForm(NewActionForm):
|
||||||
|
|
||||||
self.user_from = g.user
|
self.user_from = g.user
|
||||||
self.user_to = self.get_or_create_user(code)
|
self.user_to = self.get_or_create_user(code)
|
||||||
return
|
|
||||||
|
|
||||||
# Create supplier (from) phantom account
|
# Create supplier (from) phantom account
|
||||||
if not user_from and user_to:
|
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_from = self.get_or_create_user(code)
|
||||||
self.user_to = g.user
|
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):
|
def get_or_create_user(self, code):
|
||||||
email = "{}_{}@dhub.com".format(str(g.user.id), code)
|
email = "{}_{}@dhub.com".format(str(g.user.id), code)
|
||||||
user = User.query.filter_by(email=email).first()
|
user = User.query.filter_by(email=email).first()
|
||||||
|
|
Reference in New Issue