Commit a4c5d481 authored by Skia's avatar Skia
Browse files

Some bug fixes

parent 1f31d3b5
Pipeline #166 failed with stage
in 2 minutes and 9 seconds
......@@ -97,7 +97,7 @@ class Product(models.Model):
"""
Method to see if that object can be edited by the given user
"""
if user.is_in_group(settings.SITH_GROUPS['accounting-admin']['name']):
if user.is_in_group(settings.SITH_GROUPS['accounting-admin']['name']) or user.is_in_group(settings.SITH_GROUPS['counter-admin']['name']):
return True
return False
......
......@@ -42,7 +42,7 @@ class GetUserForm(forms.Form):
cleaned_data = super(GetUserForm, self).clean()
cus = None
if cleaned_data['code'] != "":
cus = Customer.objects.filter(account_id=cleaned_data['code']).first()
cus = Customer.objects.filter(account_id__iexact=cleaned_data['code']).first()
elif cleaned_data['id'] is not None:
cus = Customer.objects.filter(user=cleaned_data['id']).first()
sub = get_subscriber(cus.user) if cus is not None else None
......
......@@ -38,8 +38,8 @@ class Subscriber(User):
db.commit()
except Exception as e:
with open(settings.BASE_DIR+"/user_fail.log", "a") as f:
print("FAIL to add user %s (%s %s - %s) to old site" % (self.id, self.first_name, self.last_name,
self.email), file=f)
print("FAIL to add user %s (%s %s - %s) to old site" % (self.id, self.first_name.encode('utf-8'),
self.last_name.encode('utf-8'), self.email), file=f)
print("Reason: %s" % (repr(e)), file=f)
db.rollback()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment