fixing bug taiga 2280
This commit is contained in:
parent
0d4c70a74e
commit
00d2b2e81f
|
@ -577,11 +577,19 @@ class Trade(ActionWithMultipleDevices):
|
||||||
@validates_schema
|
@validates_schema
|
||||||
def validate_email_users(self, data: dict):
|
def validate_email_users(self, data: dict):
|
||||||
"""We need at least one user"""
|
"""We need at least one user"""
|
||||||
if not (data['user_from_email'] or data['user_to_email']):
|
confirm = data['confirm']
|
||||||
|
user_from = data['user_from_email']
|
||||||
|
user_to = data['user_to_email']
|
||||||
|
|
||||||
|
if not (user_from or user_to):
|
||||||
txt = "you need one user from or user to for to do a trade"
|
txt = "you need one user from or user to for to do a trade"
|
||||||
raise ValidationError(txt)
|
raise ValidationError(txt)
|
||||||
|
|
||||||
if not g.user.email in [data['user_from_email'], data['user_to_email']]:
|
if confirm and not (user_from and user_to):
|
||||||
|
txt = "you need one user for to do a trade"
|
||||||
|
raise ValidationError(txt)
|
||||||
|
|
||||||
|
if not g.user.email in [user_from, user_to]:
|
||||||
txt = "you need to be one of participate of the action"
|
txt = "you need to be one of participate of the action"
|
||||||
raise ValidationError(txt)
|
raise ValidationError(txt)
|
||||||
|
|
||||||
|
@ -596,6 +604,7 @@ class Trade(ActionWithMultipleDevices):
|
||||||
txt = "you need a code to be able to do the traceability"
|
txt = "you need a code to be able to do the traceability"
|
||||||
raise ValidationError(txt)
|
raise ValidationError(txt)
|
||||||
|
|
||||||
|
if not data['confirm']:
|
||||||
data['code'] = data['code'].replace('@', '_')
|
data['code'] = data['code'].replace('@', '_')
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue