From fd83e641a67c303e83e2ed75d1ef1e306bd2149a Mon Sep 17 00:00:00 2001 From: Bachurin Sergey Date: Fri, 25 Jul 2014 18:09:53 +0300 Subject: [PATCH] fix invoices list --- project/docs/forms/base_forms.py | 5 +++++ project/templates/docs/stub_js.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/project/docs/forms/base_forms.py b/project/docs/forms/base_forms.py index 30a4d72..871d194 100644 --- a/project/docs/forms/base_forms.py +++ b/project/docs/forms/base_forms.py @@ -4,6 +4,7 @@ import autocomplete_light from project.commons.forms import MyBaseModelForm from project.customer.models import BankAccount, Client +from project.docs.models import Invoice class BaseModelForm(MyBaseModelForm): @@ -50,6 +51,10 @@ class BaseModelForm(MyBaseModelForm): # Если в форме есть поле client, настроить связь с Client: чтобы можно было выбрать __только__ # контрагентов данного пользователя. + if 'invoice' in f: + user_invoices = Invoice.objects.filter(user=self._user) + f['invoice'].queryset = user_invoices + if 'client' in f: user_clients = Client.objects.filter(user=self._user) f['client'].queryset = user_clients diff --git a/project/templates/docs/stub_js.html b/project/templates/docs/stub_js.html index 8b71381..09a648f 100644 --- a/project/templates/docs/stub_js.html +++ b/project/templates/docs/stub_js.html @@ -66,7 +66,7 @@ $('#id_client-deck').html('X' + data[1] + ''); $('#id_client').html(''); - $('#id_client').trigger('change'); + //$('#id_client').trigger('change'); }) $.get('/my/docs/ajax_get_tbl_items/' + invoice_id, function(data) {