fix invoices list

remotes/origin/yandex
Bachurin Sergey 12 years ago
parent 67a39e6ae9
commit fd83e641a6
  1. 5
      project/docs/forms/base_forms.py
  2. 2
      project/templates/docs/stub_js.html

@ -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

@ -66,7 +66,7 @@
$('#id_client-deck').html('<span class="div hilight" data-value='+ data[0] +'><span class="remove div" style="display: inline;">X</span>' + data[1] + '</span>');
$('#id_client').html('<option selected="selected" value="'+ data[0] +'"></option>');
$('#id_client').trigger('change');
//$('#id_client').trigger('change');
})
$.get('/my/docs/ajax_get_tbl_items/' + invoice_id, function(data) {

Loading…
Cancel
Save