diff --git a/src/customer/models.py b/src/customer/models.py index c505488..23614d9 100644 --- a/src/customer/models.py +++ b/src/customer/models.py @@ -14,9 +14,10 @@ from customer import consts, managers, utils from myauth.models import DokUser from commons.utils import only_numerics from django.utils.deconstruct import deconstructible -from django.core.exceptions import ValidationError -PROFILE_IMAGES_UPLOAD_DIR = 'customer/profile/' # куда сохранять загруженные изображения +# куда сохранять загруженные изображения +PROFILE_IMAGES_UPLOAD_DIR = 'customer/profile/' + BOSS_SIGN_IMG_SIZE = (159, 65) GLAVBUH_SIGN_IMG_SIZE = (159, 65) STAMP_IMG_SIZE = (180, 180) @@ -177,7 +178,7 @@ class UserProfile(models.Model): def get_main_bank_account(self): try: - bank_accounts = BankAccount.objects.filter(company=self, is_main=True)[0] + bank_accounts = BankAccount.objects.filter(company=self, is_main=True).first() return bank_accounts except BankAccount.DoesNotExist: return None @@ -262,6 +263,17 @@ class UserProfile(models.Model): fax_code = u'(%s)' % fax_code if fax_code else fax_code return (u'%s %s' % (fax_code, self.fax,)).strip() + # TODO : test + def validate_has_profile_account(self): + """ + Check there account from this profile + :return: True or False + """ + if self.bank_accounts.all(): + return True + else: + return False + class BankAccount(models.Model): """Расчетные счета.""" diff --git a/src/dokumentor/templates/docs/_base/base_list.html b/src/dokumentor/templates/docs/_base/base_list.html index b3c5b3c..e627021 100644 --- a/src/dokumentor/templates/docs/_base/base_list.html +++ b/src/dokumentor/templates/docs/_base/base_list.html @@ -8,6 +8,9 @@ {% if user.profile.check_main_reqs_not_filled %}
Документор не может создать ничего, пока вы не добавите в него свои реквизиты. Заполните хотя бы те поля, которые отмечены * на странице Мои реквизиты.
{% else %} +{% if not user.profile.validate_has_profile_account %} +Документор не может создать ничего, пока вы не добавите в него свои реквизиты.Пожалуйста, укажите свои банковские реквизиты на странице Мои реквизиты.
+{% else %} {% url url_prefix|add:'add' as url_add %} {% with img_desc='
' img_asc='
' img_none='
' %}
@@ -128,6 +131,7 @@
{% endif %}
{% endwith %}
{% endif %}
+ {% endif %}
{% endblock %}
diff --git a/src/dokumentor/templates/docs/_base/preview.html b/src/dokumentor/templates/docs/_base/preview.html
index 058be68..cd22b86 100644
--- a/src/dokumentor/templates/docs/_base/preview.html
+++ b/src/dokumentor/templates/docs/_base/preview.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load static %}
{% block title %}Просмотр {{ padeji.rodit }} №{{ obj.doc_num }} от {{ obj.doc_date }}{% endblock %}
@@ -57,6 +58,6 @@
var CLIENT = new Object;
CLIENT.get_url_pattern = "{% url 'customer_clients_get_ajax' 0 %}";
-
-
+
+
{% endblock %}