diff --git a/project/customer/views/bank_accounts.py b/project/customer/views/bank_accounts.py index b154da1..0ab6efa 100644 --- a/project/customer/views/bank_accounts.py +++ b/project/customer/views/bank_accounts.py @@ -40,7 +40,6 @@ def bank_accounts_add(request): form = form_class(data=request.POST) if form.is_valid(): new_account = form.save(commit=False) - print new_account new_account.company = request.user.profile new_account.save() return redirect(success_url) diff --git a/project/docs/forms/email.py b/project/docs/forms/email.py index 0c5fca2..22d0d5c 100644 --- a/project/docs/forms/email.py +++ b/project/docs/forms/email.py @@ -15,5 +15,7 @@ class EmailForm(forms.Form): widget=forms.Textarea(attrs={'cols': 80, 'rows': 3})) doc_format = forms.ChoiceField(label=u'Отправить как', choices=DOC_FORMATS, initial=DOC_FORMATS[0][0], widget=forms.RadioSelect()) + insert_sign = forms.BooleanField(label=u'Вставить печать и подпись', initial=False, + required=False) save_client_email = forms.BooleanField(label=u'Сохранить этот e-mail в анкете контрагента', initial=False, required=False) diff --git a/project/docs/views/aktrabot.py b/project/docs/views/aktrabot.py index 533e998..4b074e9 100644 --- a/project/docs/views/aktrabot.py +++ b/project/docs/views/aktrabot.py @@ -41,6 +41,7 @@ class AktRabotViews(BaseItemsViews, AddByInvoiceMethodMixin): PDF_TEMPLATE = 'docs/aktrabot/as_pdf.html' XLS_TEMPLATE = 'aktrabot.xls' FILENAME = u'Акт выполненных работ № %s, %s' # без расширения + MAYBE_SIGNED = True # --- грамматика для вывода наименований в шаблонах PADEJI = { diff --git a/project/docs/views/base_views.py b/project/docs/views/base_views.py index 5885bef..02f38b2 100644 --- a/project/docs/views/base_views.py +++ b/project/docs/views/base_views.py @@ -95,6 +95,7 @@ class BaseViews(object): PDF_TEMPLATE = '' XLS_TEMPLATE = '' FILENAME = u'Документ № %s, %s' # без расширения + MAYBE_SIGNED = False # --- константы для вывода наименований в шаблонах PADEJI = { @@ -229,6 +230,7 @@ class BaseViews(object): 'obj_list_count_before_filtering': obj_list_count_before_filtering, 'email_form': email_form, 'template_create_docs': self.TEMPLATE_CREATE_DOCS, + 'maybe_sign': self.MAYBE_SIGNED, } self.update_list_dict(dictionary) return render(self.request, self.TEMPLATE_LIST, dictionary) @@ -363,6 +365,7 @@ class BaseViews(object): 'obj_items': None, 'profile': profile, 'main_account': main_account, + 'doc_sign': kwargs.get('doc_sign', True), } c1 = time() pdf = render_pdf_to_string(self.request, self.PDF_TEMPLATE, params) @@ -459,7 +462,7 @@ class BaseViews(object): else: return HttpResponseServerError('Server error. Try later.') - def send_email(self, subject, to, body, files): + def send_email(self, subject, to, body, files, sign_doc): """Отправка письма.""" dict_context = {'body': body, 'support_email': SUPPORT_EMAIL,} email_body = render_to_string(self.EMAIL_MSG_TEMPLATE, dict_context) @@ -480,6 +483,7 @@ class BaseViews(object): client.save() doc_format = form.cleaned_data['doc_format'] + kwargs['doc_sign'] = form.cleaned_data.get('insert_sign', False) if doc_format in ('pdf', 'xls',): files = [] filename = self.get_filename(*args, **kwargs) @@ -500,7 +504,8 @@ class BaseViews(object): subject = u'%s' % filename, # тема письма = имя файла без расширения to = form.cleaned_data['to'], body = form.cleaned_data['body'], - files = files + files = files, + sign_doc = form.cleaned_data.get('save_client_email', None) ) return False # что-то пошло не так @@ -794,6 +799,7 @@ class BaseItemsViews(BaseViews): 'obj_items': obj_items, 'profile': profile, 'main_account': main_account, + 'doc_sign': kwargs.get('doc_sign', True), } c1 = time() pdf = render_pdf_to_string(self.request, self.PDF_TEMPLATE, params) diff --git a/project/docs/views/invoice.py b/project/docs/views/invoice.py index 9a1bf96..18543fd 100644 --- a/project/docs/views/invoice.py +++ b/project/docs/views/invoice.py @@ -43,6 +43,7 @@ class InvoiceViews(BaseItemsViews): PDF_TEMPLATE = 'docs/invoice/as_pdf.html' XLS_TEMPLATE = 'invoice.xls' FILENAME = u'Счет № %s, %s' # без расширения + MAYBE_SIGNED = True # --- грамматика для вывода наименований в шаблонах PADEJI = { diff --git a/project/docs/views/nakladn.py b/project/docs/views/nakladn.py index c45c603..83f4404 100644 --- a/project/docs/views/nakladn.py +++ b/project/docs/views/nakladn.py @@ -43,6 +43,7 @@ class NakladnViews(BaseItemsViews, AddByInvoiceMethodMixin): PDF_TEMPLATE = 'docs/nakladn/as_pdf.html' XLS_TEMPLATE = 'nakladn.xls' FILENAME = u'Накладная № %s, %s' # без расширения + MAYBE_SIGNED = True # --- грамматика для вывода наименований в шаблонах PADEJI = { diff --git a/project/templates/docs/aktrabot/as_pdf.html b/project/templates/docs/aktrabot/as_pdf.html index da28691..e580d3d 100644 --- a/project/templates/docs/aktrabot/as_pdf.html +++ b/project/templates/docs/aktrabot/as_pdf.html @@ -21,6 +21,7 @@ .center { text-align: center; } .top { vertical-align: top; } + .bottom { vertical-align: bottom; } .bold { font-weight: bold; } .font_8 { font-size: 8pt; } @@ -145,10 +146,18 @@
|
- {% if profile.boss_sign %} {# TODO передавать флаг из вьюхи #}
+ {% if doc_sign and profile.boss_sign %} {# TODO передавать флаг из вьюхи #}
|
@@ -182,7 +182,7 @@
||||||||||||||||||||||||||||||||||||||||||||||
| Главный бухгалтер |
- {% if profile.glavbuh_sign %} {# TODO передавать флаг из вьюхи #}
+ {% if doc_sign and profile.glavbuh_sign %} {# TODO передавать флаг из вьюхи #}
@@ -197,10 +197,10 @@ | |||||||||||||||||||||||||||||||||||||||||||||
| Главный бухгалтер |
- {% if profile.glavbuh_sign %}
+ {% if doc_sign and profile.glavbuh_sign %}
@@ -219,7 +219,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||
|
- {% if obj.add_sign_and_stamp and profile.stamp %} {# TODO передавать флаг из вьюхи #}
+ {% if doc_sign and profile.stamp %} {# TODO передавать флаг из вьюхи #}
|
diff --git a/project/templates/docs/nakladn/as_pdf.html b/project/templates/docs/nakladn/as_pdf.html
index afe0e63..b077f50 100644
--- a/project/templates/docs/nakladn/as_pdf.html
+++ b/project/templates/docs/nakladn/as_pdf.html
@@ -497,12 +497,16 @@
||||||||||||||||||||||||||||||||||||||||||||||
| Отпуск груза разрешил | -+ | Отпуск груза разрешил | +{{ profile.boss_title|default:'' }} | - | + |
+ {% if doc_sign and profile.boss_sign %}
+ |
- | {{ profile.get_boss_fio }} | +{{ profile.get_boss_fio }} | {# правая половина #} | @@ -521,15 +525,19 @@ | |||||||||||||||||||||||||||||||||||
| Главный (старший) бухгалтер | +Главный (старший) бухгалтер | - | + |
+ {% if doc_sign and profile.glavbuh_sign %}
+ |
- | {{ profile.get_glavbuh_fio }} | +{{ profile.get_glavbuh_fio }} | {# правая половина #} | - | Груз принял | +Груз принял | @@ -595,7 +603,13 @@ | ||||||||||||||||||||||||||||||||||
| М.П. | ++ {% if not doc_sign or not profile.stamp %} {# TODO передавать флаг из вьюхи #} + М. П. + {% else %} + + {% endif %} + | « | @@ -618,6 +632,25 @@ | года | ||||||||||||||||
|
+ {% if doc_sign and profile.stamp %} {# TODO передавать флаг из вьюхи #}
+ |
+ {# правая половина #}
+ + | + | + | + | + | + | + | + | + | + | + | |||||||||