Some bug fixes

This commit is contained in:
Skia 2016-09-01 10:00:31 +02:00
parent 1f31d3b56f
commit a4c5d48159
3 changed files with 4 additions and 4 deletions

View File

@ -97,7 +97,7 @@ class Product(models.Model):
""" """
Method to see if that object can be edited by the given user 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 True
return False return False

View File

@ -42,7 +42,7 @@ class GetUserForm(forms.Form):
cleaned_data = super(GetUserForm, self).clean() cleaned_data = super(GetUserForm, self).clean()
cus = None cus = None
if cleaned_data['code'] != "": 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: elif cleaned_data['id'] is not None:
cus = Customer.objects.filter(user=cleaned_data['id']).first() cus = Customer.objects.filter(user=cleaned_data['id']).first()
sub = get_subscriber(cus.user) if cus is not None else None sub = get_subscriber(cus.user) if cus is not None else None

View File

@ -38,8 +38,8 @@ class Subscriber(User):
db.commit() db.commit()
except Exception as e: except Exception as e:
with open(settings.BASE_DIR+"/user_fail.log", "a") as f: 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, print("FAIL to add user %s (%s %s - %s) to old site" % (self.id, self.first_name.encode('utf-8'),
self.email), file=f) self.last_name.encode('utf-8'), self.email), file=f)
print("Reason: %s" % (repr(e)), file=f) print("Reason: %s" % (repr(e)), file=f)
db.rollback() db.rollback()