no requisits - no invoices

remotes/origin/yandex
Bachurin Sergey 12 years ago
parent 98c8f7f6e4
commit d2c989df2d
  1. 21
      project/customer/models.py
  2. 5
      project/templates/docs/_base/base_list.html
  3. 4
      project/templates/docs/invoice/as_pdf.html

@ -157,6 +157,27 @@ class UserProfile(models.Model):
return self.name.strip() == '' return self.name.strip() == ''
return False return False
def get_main_bank_account(self):
try:
bank_accounts = BankAccount.objects.filter(user=self.user, is_main=True)[0]
except:
return None
def check_main_reqs_not_filled(self):
result = self.check_name_not_filled() or self.inn == '' or self.address == '' or \
self.get_boss_fio() == '' or self.get_main_bank_account() == ''
print result
if result:
print 111
return True
if self.is_ip():
print 222
return self.ogrn == ''
elif self.is_org():
print 333
return self.kpp == ''
def get_company_name(self): def get_company_name(self):
"""`ИП ФИО` или `Название Организации`.""" """`ИП ФИО` или `Название Организации`."""
if self.profile_type == consts.IP_PROFILE: if self.profile_type == consts.IP_PROFILE:

@ -3,7 +3,9 @@
{% block title %}{{ padeji_mnoj.imenit|capfirst }}{% endblock %} {% block title %}{{ padeji_mnoj.imenit|capfirst }}{% endblock %}
{% block content %} {% block content %}
{% if user.profile.check_main_reqs_not_filled %}
<p>Документор не может создать ничего, пока вы не добавите в него свои реквизиты. Заполните хотя бы те поля, которые отмечены * на странице <a href="{% url "customer_profile_edit" %}">Мои реквизиты</a>.</p>
{% else %}
{% url url_prefix|add:'add' as url_add %} {% url url_prefix|add:'add' as url_add %}
{% if page or obj_list_count_before_filtering > 0 %} {% if page or obj_list_count_before_filtering > 0 %}
@ -116,6 +118,7 @@
{% endblock %} {% endblock %}
</p> </p>
{% endif %} {% endif %}
{% endif %}
{% endblock %} {% endblock %}
{% block dialogs %} {% block dialogs %}

@ -34,11 +34,15 @@
<div id="header"> <div id="header">
<table width="100%"> <table width="100%">
{% if profile.logo %}
<tr class=""> <tr class="">
<td width="20%"> <td width="20%">
{% if profile.logo %}<img src="{{ profile.logo.path }}" />{% endif %} {% if profile.logo %}<img src="{{ profile.logo.path }}" />{% endif %}
</td> </td>
<td width="80%"> <td width="80%">
{% else %}
<td width="100%">
{% endif %}
{{ profile.get_company_name }}<br /> {{ profile.get_company_name }}<br />
{{ profile.address }} {{ profile.address }}
{% if profile.phone %} , тел. {{ profile.get_full_phone }}{% endif %}<br /> {% if profile.phone %} , тел. {{ profile.get_full_phone }}{% endif %}<br />

Loading…
Cancel
Save