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