Skip to content
Snippets Groups Projects
Commit 4fd65ce2 authored by sks444's avatar sks444
Browse files

Fix migrations and editing

parent 28d93c78
No related branches found
No related tags found
No related merge requests found
# Generated by Django 2.2.24 on 2021-06-14 07:09 # Generated by Django 2.2.24 on 2021-06-14 11:33
from django.conf import settings from django.conf import settings
import django.core.files.storage import django.core.files.storage
...@@ -56,37 +56,37 @@ class Migration(migrations.Migration): ...@@ -56,37 +56,37 @@ class Migration(migrations.Migration):
('contractor_name_label', models.TextField(default="2. What is the individual's name who is signing the contract?", verbose_name='label')), ('contractor_name_label', models.TextField(default="2. What is the individual's name who is signing the contract?", verbose_name='label')),
('contractor_name_help_text', wagtail.core.fields.RichTextField(blank=True, default='This person is is authorised to sign contract on behalf of the person or organization named above.', verbose_name='help text')), ('contractor_name_help_text', wagtail.core.fields.RichTextField(blank=True, default='This person is is authorised to sign contract on behalf of the person or organization named above.', verbose_name='help text')),
('type_label', models.TextField(default='3. Is the bank account owned by the person or organisation in the Question 1 above?', verbose_name='label')), ('type_label', models.TextField(default='3. Is the bank account owned by the person or organisation in the Question 1 above?', verbose_name='label')),
('type_help_text', wagtail.core.fields.RichTextField(default='The name of the bank account must be the same as on the contract.', verbose_name='help_text')), ('type_help_text', wagtail.core.fields.RichTextField(blank=True, default='The name of the bank account must be the same as on the contract.', verbose_name='help_text')),
('required_to_pay_taxes_label', models.TextField(default='Is the organisation required to pay US taxes?', verbose_name='label')), ('required_to_pay_taxes_label', models.TextField(default='Is the organisation required to pay US taxes?', verbose_name='label')),
('required_to_pay_taxes_help_text', wagtail.core.fields.RichTextField(blank=True, default='', verbose_name='help_text')), ('required_to_pay_taxes_help_text', wagtail.core.fields.RichTextField(blank=True, default='', verbose_name='help_text')),
('due_diligence_documents_label', models.TextField(default='Due Diligence Documents', verbose_name='label')), ('due_diligence_documents_label', models.TextField(default='Due Diligence Documents', verbose_name='label')),
('due_diligence_documents_help_text', wagtail.core.fields.RichTextField(default='Upload Due Diligence Documents. E.g. w8/w9 forms.', verbose_name='help_text')), ('due_diligence_documents_help_text', wagtail.core.fields.RichTextField(blank=True, default='Upload Due Diligence Documents. E.g. w8/w9 forms.', verbose_name='help_text')),
('account_holder_name_label', models.TextField(default='Bank Account Holder name', verbose_name='label')), ('account_holder_name_label', models.TextField(default='Bank Account Holder name', verbose_name='label')),
('account_holder_name_help_text', wagtail.core.fields.RichTextField(default='This name must be same as the person or organisation that signed the contract. This person is authorised to sign contracts on behalf of the person or organisation named above.', verbose_name='help_text')), ('account_holder_name_help_text', wagtail.core.fields.RichTextField(blank=True, default='This name must be same as the person or organisation that signed the contract. This person is authorised to sign contracts on behalf of the person or organisation named above.', verbose_name='help_text')),
('account_routing_number_label', models.TextField(default='Bank Account Routing number', verbose_name='label')), ('account_routing_number_label', models.TextField(default='Bank Account Routing number', verbose_name='label')),
('account_routing_number_help_text', wagtail.core.fields.RichTextField(default='Depending on your country, this might be called the ACH, SWIFT, BIC or ABA number.', verbose_name='help_text')), ('account_routing_number_help_text', wagtail.core.fields.RichTextField(blank=True, default='Depending on your country, this might be called the ACH, SWIFT, BIC or ABA number.', verbose_name='help_text')),
('account_number_label', models.TextField(default='Bank Account Number', verbose_name='label')), ('account_number_label', models.TextField(default='Bank Account Number', verbose_name='label')),
('account_number_help_text', wagtail.core.fields.RichTextField(default='Depending on your country, this might be called the account number, IBAN, or BBAN number.', verbose_name='help_text')), ('account_number_help_text', wagtail.core.fields.RichTextField(blank=True, default='Depending on your country, this might be called the account number, IBAN, or BBAN number.', verbose_name='help_text')),
('account_currency_label', models.TextField(default='Bank Account Currency', verbose_name='label')), ('account_currency_label', models.TextField(default='Bank Account Currency', verbose_name='label')),
('account_currency_help_text', wagtail.core.fields.RichTextField(default='This is the currency of this bank account.', verbose_name='label')), ('account_currency_help_text', wagtail.core.fields.RichTextField(blank=True, default='This is the currency of this bank account.', verbose_name='label')),
('need_extra_info_label', models.TextField(default='Do you need to provide us with extra information?', verbose_name='label')), ('need_extra_info_label', models.TextField(default='Do you need to provide us with extra information?', verbose_name='label')),
('need_extra_info_help_text', wagtail.core.fields.RichTextField(default='', verbose_name='help_text')), ('need_extra_info_help_text', wagtail.core.fields.RichTextField(blank=True, default='', verbose_name='help_text')),
('branch_address_label', models.TextField(default='Bank Account Branch Address', verbose_name='label')), ('branch_address_label', models.TextField(default='Bank Account Branch Address', verbose_name='label')),
('branch_address_help_text', models.TextField(default='The address of the bank branch where you have the bank account located(not the bank account holder address)', verbose_name='help_text')), ('branch_address_help_text', models.TextField(blank=True, default='The address of the bank branch where you have the bank account located(not the bank account holder address)', verbose_name='help_text')),
('ib_account_routing_number_label', models.TextField(default='Bank Account Routing Number', verbose_name='label')), ('ib_account_routing_number_label', models.TextField(default='Intermediary Bank Account Routing Number', verbose_name='label')),
('ib_account_routing_number_help_text', wagtail.core.fields.RichTextField(default='Depending on your country, this might be called ACH, SWIFT, BIC or ABA number', verbose_name='help_text')), ('ib_account_routing_number_help_text', wagtail.core.fields.RichTextField(blank=True, default='Depending on your country, this might be called ACH, SWIFT, BIC or ABA number', verbose_name='help_text')),
('ib_account_number_label', models.TextField(default='Bank Account Number', verbose_name='label')), ('ib_account_number_label', models.TextField(default='Intermediary Bank Account Number', verbose_name='label')),
('ib_account_number_help_text', wagtail.core.fields.RichTextField(default='Depending on your country, this might be called the account number, IBAN, or BBAN number', verbose_name='help_text')), ('ib_account_number_help_text', wagtail.core.fields.RichTextField(blank=True, default='Depending on your country, this might be called the account number, IBAN, or BBAN number', verbose_name='help_text')),
('ib_account_currency_label', models.TextField(default='Bank Account Currency', verbose_name='label')), ('ib_account_currency_label', models.TextField(default='Intermediary Bank Account Currency', verbose_name='label')),
('ib_account_currency_help_text', wagtail.core.fields.RichTextField(default='This is the currency of this bank account', verbose_name='help_text')), ('ib_account_currency_help_text', wagtail.core.fields.RichTextField(blank=True, default='This is the currency of this bank account', verbose_name='help_text')),
('ib_branch_address_label', models.TextField(default='Intermediary Bank Branch Address', verbose_name='label')), ('ib_branch_address_label', models.TextField(default='Intermediary Bank Branch Address', verbose_name='label')),
('ib_branch_address_help_text', wagtail.core.fields.RichTextField(default='Bank branch address(not the bank account holder address)', verbose_name='help_text')), ('ib_branch_address_help_text', wagtail.core.fields.RichTextField(blank=True, default='Bank branch address(not the bank account holder address)', verbose_name='help_text')),
('nid_type_label', models.TextField(default='National Identity Document Type', verbose_name='label')), ('nid_type_label', models.TextField(default='Account Holder National Identity Document Type', verbose_name='label')),
('nid_type_help_text', wagtail.core.fields.RichTextField(default='This could be a passport, a National Identity number, or other national identity document.', verbose_name='help_text')), ('nid_type_help_text', wagtail.core.fields.RichTextField(blank=True, default='This could be a passport, a National Identity number, or other national identity document.', verbose_name='help_text')),
('nid_number_label', models.TextField(default='National Identity Document Number', verbose_name='label')), ('nid_number_label', models.TextField(default='Account Holder National Identity Document Number', verbose_name='label')),
('nid_number_help_text', wagtail.core.fields.RichTextField(default='', verbose_name='help_text')), ('nid_number_help_text', wagtail.core.fields.RichTextField(blank=True, default='', verbose_name='help_text')),
('other_info_label', models.TextField(default='Other Information', verbose_name='label')), ('other_info_label', models.TextField(default='Other Information', verbose_name='label')),
('other_info_help_text', wagtail.core.fields.RichTextField(default='If you need to include other information not listed above, provide it here.', verbose_name='help_text')), ('other_info_help_text', wagtail.core.fields.RichTextField(blank=True, default='If you need to include other information not listed above, provide it here.', verbose_name='help_text')),
('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')), ('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')),
], ],
options={ options={
......
...@@ -185,7 +185,7 @@ class VendorFormSettings(BaseSetting): ...@@ -185,7 +185,7 @@ class VendorFormSettings(BaseSetting):
) )
ib_account_routing_number_label = models.TextField( ib_account_routing_number_label = models.TextField(
'label', 'label',
default='Bank Account Routing Number' default='Intermediary Bank Account Routing Number'
) )
ib_account_routing_number_help_text = RichTextField( ib_account_routing_number_help_text = RichTextField(
'help_text', 'help_text',
...@@ -194,7 +194,7 @@ class VendorFormSettings(BaseSetting): ...@@ -194,7 +194,7 @@ class VendorFormSettings(BaseSetting):
) )
ib_account_number_label = models.TextField( ib_account_number_label = models.TextField(
'label', 'label',
default='Bank Account Number' default='Intermediary Bank Account Number'
) )
ib_account_number_help_text = RichTextField( ib_account_number_help_text = RichTextField(
'help_text', 'help_text',
...@@ -203,7 +203,7 @@ class VendorFormSettings(BaseSetting): ...@@ -203,7 +203,7 @@ class VendorFormSettings(BaseSetting):
) )
ib_account_currency_label = models.TextField( ib_account_currency_label = models.TextField(
'label', 'label',
default='Bank Account Currency' default='Intermediary Bank Account Currency'
) )
ib_account_currency_help_text = RichTextField( ib_account_currency_help_text = RichTextField(
'help_text', 'help_text',
...@@ -221,7 +221,7 @@ class VendorFormSettings(BaseSetting): ...@@ -221,7 +221,7 @@ class VendorFormSettings(BaseSetting):
) )
nid_type_label = models.TextField( nid_type_label = models.TextField(
'label', 'label',
default='National Identity Document Type' default='Account Holder National Identity Document Type'
) )
nid_type_help_text = RichTextField( nid_type_help_text = RichTextField(
'help_text', 'help_text',
...@@ -231,7 +231,7 @@ class VendorFormSettings(BaseSetting): ...@@ -231,7 +231,7 @@ class VendorFormSettings(BaseSetting):
) )
nid_number_label = models.TextField( nid_number_label = models.TextField(
'label', 'label',
default='National Identity Document Number' default='Account Holder National Identity Document Number'
) )
nid_number_help_text = RichTextField( nid_number_help_text = RichTextField(
'help_text', 'help_text',
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<p class="docs-block__title">Contractor Setup Form</p> <p class="docs-block__title">Contractor Setup Form</p>
</div> </div>
<div class="docs-block__row-inner"> <div class="docs-block__row-inner">
<a class="docs-block__link" href="{% url 'apply:projects:vendor' pk=project.pk %}">Add info</a> <a class="docs-block__link" href="{% url 'apply:projects:vendor' pk=project.pk %}">Update info</a>
</div> </div>
</li> </li>
......
...@@ -7,7 +7,7 @@ from wagtail.core.models import Site ...@@ -7,7 +7,7 @@ from wagtail.core.models import Site
from formtools.wizard.views import SessionWizardView from formtools.wizard.views import SessionWizardView
from hypha.apply.utils.storage import PrivateStorage from hypha.apply.utils.storage import PrivateStorage
from ..models import Project, Vendor, DueDiligenceDocument, BankInformation from ..models import Project, DueDiligenceDocument, BankInformation
from ..forms import ( from ..forms import (
CreateVendorFormStep1, CreateVendorFormStep1,
CreateVendorFormStep2, CreateVendorFormStep2,
...@@ -56,28 +56,50 @@ class CreateVendorView(VendorAccessMixin, SessionWizardView): ...@@ -56,28 +56,50 @@ class CreateVendorView(VendorAccessMixin, SessionWizardView):
cleaned_data = self.get_all_cleaned_data() cleaned_data = self.get_all_cleaned_data()
vendor = vendor_project.vendor vendor = vendor_project.vendor
need_extra_info = cleaned_data['need_extra_info'] need_extra_info = cleaned_data['need_extra_info']
bank_information = BankInformation.objects.create( bank_info = vendor.bank_info
account_holder_name=cleaned_data['account_holder_name'], account_holder_name = cleaned_data['account_holder_name']
account_routing_number=cleaned_data['account_routing_number'], account_routing_number = cleaned_data['account_routing_number']
account_number=cleaned_data['account_number'], account_number = cleaned_data['account_number']
account_currency=cleaned_data['account_currency'], account_currency = cleaned_data['account_currency']
need_extra_info=need_extra_info, if not bank_info:
) bank_info = BankInformation.objects.create(
if need_extra_info: account_holder_name=account_holder_name,
intermediary_bank_information = BankInformation.objects.create( account_number=account_number,
account_routing_number=cleaned_data['ib_account_routing_number'], account_routing_number=account_routing_number,
account_number=cleaned_data['ib_account_number'], account_currency=account_currency,
account_currency=cleaned_data['ib_account_currency'], need_extra_info=need_extra_info,
# branch_address=cleaned_data['ib_branch_address']
) )
bank_information.branch_address = cleaned_data['branch_address'] else:
bank_information.nid_type = cleaned_data['nid_type'] bank_info.account_holder_name = account_holder_name
bank_information.nid_number = cleaned_data['nid_number'] bank_info.account_number = account_number
bank_information.iba_info = intermediary_bank_information bank_info.account_currency = account_currency
bank_information.save() bank_info.need_extra_info = need_extra_info
if need_extra_info:
vendor.bank_info = bank_information ib_account_routing_number = cleaned_data['ib_account_routing_number']
vendor.other_info = cleaned_data['other_info'] ib_account_number = cleaned_data['ib_account_number']
ib_account_currency = cleaned_data['ib_account_currency']
# branch_address=cleaned_data['ib_branch_address']
iba_info = bank_info.iba_info
if not iba_info:
iba_info = BankInformation.objects.create(
account_routing_number=ib_account_routing_number,
account_number=ib_account_number,
account_currency=ib_account_currency,
)
else:
iba_info.account_routing_number = ib_account_routing_number
iba_info.account_number = ib_account_number
iba_info.account_currency = ib_account_currency
bank_info.branch_address = cleaned_data['branch_address']
bank_info.nid_type = cleaned_data['nid_type']
bank_info.nid_number = cleaned_data['nid_number']
bank_info.iba_info = iba_info
vendor.other_info = cleaned_data['other_info']
bank_info.save()
vendor.bank_info = bank_info
vendor.name = cleaned_data['name'] vendor.name = cleaned_data['name']
vendor.contractor_name = cleaned_data['contractor_name'] vendor.contractor_name = cleaned_data['contractor_name']
vendor.type = cleaned_data['type'] vendor.type = cleaned_data['type']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment