WIP: Aureplop/kpsul js refactor #501
3 changed files with 9 additions and 1 deletions
|
@ -113,6 +113,9 @@ class KHistory {
|
|||
if (options.transfersonly && opegroup.constructor.verbose_name == 'opegroup')
|
||||
return false;
|
||||
|
||||
if (options.opesonly && opegroup.constructor.verbose_name == 'transfergroup')
|
||||
return false;
|
||||
|
||||
if (options.accounts && options.accounts.length &&
|
||||
options.accounts.indexOf(opegroup.account_id) < 0)
|
||||
return false;
|
||||
|
|
|
@ -12,7 +12,9 @@ class KPsulManager {
|
|||
this.account_manager = new AccountManager(this);
|
||||
this.checkout_manager = new CheckoutManager(this);
|
||||
this.article_manager = new ArticleManager(this);
|
||||
this.history = new KHistory();
|
||||
this.history = new KHistory({
|
||||
api_options: {'opesonly': true},
|
||||
});
|
||||
|
||||
this._init_events();
|
||||
}
|
||||
|
|
|
@ -1468,6 +1468,7 @@ def history_json(request):
|
|||
checkouts = request.GET.getlist('checkouts[]', None)
|
||||
accounts = request.GET.getlist('accounts[]', None)
|
||||
transfers_only = request.GET.get('transfersonly', None)
|
||||
opes_only = request.GET.get('opesonly', None)
|
||||
|
||||
# Un non-membre de l'équipe n'a que accès à son historique
|
||||
if not request.user.has_perm('kfet.is_team'):
|
||||
|
@ -1525,6 +1526,8 @@ def history_json(request):
|
|||
transfergroups = TransferGroup.objects.none()
|
||||
if transfers_only:
|
||||
opegroups = OperationGroup.objects.none()
|
||||
if opes_only:
|
||||
transfergroups = TransferGroup.objects.none()
|
||||
if accounts:
|
||||
opegroups = opegroups.filter(on_acc_id__in=accounts)
|
||||
|
||||
|
|
Loading…
Reference in a new issue