From f4551c8b5aa4fc79d82363f20fcf981ed102a2df Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Sat, 8 Feb 2014 14:42:57 +0530 Subject: [PATCH] Fix: Error in purchase return where the check for batch date was wrong. Fix: Added some common validation for inputs Feature: created a to_uuid function which will return uuid if the string is correct else None to parse uuid inputs. Fix: Proper modal template so that the modal is proper width --- brewman/models/auth.py | 2 ++ brewman/static/scripts/account.js | 1 - brewman/static/template/modal/confirm.html | 26 +++++++++++-------- brewman/static/template/modal/window.html | 2 +- brewman/views/__init__.py | 13 ++++++++-- brewman/views/employee.py | 9 ++++++- brewman/views/reports/product_ledger.py | 9 +++++-- .../views/services/voucher/purchase_return.py | 6 ++--- 8 files changed, 47 insertions(+), 21 deletions(-) diff --git a/brewman/models/auth.py b/brewman/models/auth.py index 97e37958..73f95f9a 100644 --- a/brewman/models/auth.py +++ b/brewman/models/auth.py @@ -108,6 +108,8 @@ class User(Base): @classmethod def by_name(cls, name): + if not name: + return None return DBSession.query(cls).filter(cls.name.ilike(name)).first() @classmethod diff --git a/brewman/static/scripts/account.js b/brewman/static/scripts/account.js index 57b47f9f..65f8f98b 100644 --- a/brewman/static/scripts/account.js +++ b/brewman/static/scripts/account.js @@ -59,7 +59,6 @@ var AccountCtrl = ['$scope', '$location', '$modal', 'account', 'account_types', AccountCtrl.resolve = { account: ['$route', 'Account', function ($route, Account) { var id = $route.current.params.id; - return Account.get({id: id}).$promise; }], account_types: ['AccountType', function (AccountType) { diff --git a/brewman/static/template/modal/confirm.html b/brewman/static/template/modal/confirm.html index c644e15a..b7a09234 100644 --- a/brewman/static/template/modal/confirm.html +++ b/brewman/static/template/modal/confirm.html @@ -1,13 +1,17 @@ -