Billing Entity Management #66
2 changed files with 17 additions and 24 deletions
|
@ -90,26 +90,19 @@ class OrganizationCreateForm(OrganizationForm):
|
|||
choice = cleaned_data.get("billing_processing_choice")
|
||||
if choice == "new":
|
||||
required_fields = [
|
||||
"ba_name",
|
||||
"ba_street",
|
||||
"ba_city",
|
||||
"ba_zip",
|
||||
"ba_state_name",
|
||||
"ba_country_name",
|
||||
"ba_email",
|
||||
"invoice_street",
|
||||
"invoice_city",
|
||||
"invoice_zip",
|
||||
"invoice_country",
|
||||
"invoice_email",
|
||||
]
|
||||
for field_name in required_fields:
|
||||
if not cleaned_data.get(field_name):
|
||||
self.add_error(
|
||||
field_name,
|
||||
_(
|
||||
"This field is required when creating a new billing address."
|
||||
),
|
||||
)
|
||||
self.add_error(field_name, _("This field is required."))
|
||||
else:
|
||||
existing_id_str = cleaned_data.get("existing_odoo_address_id")
|
||||
if not existing_id_str:
|
||||
self.add_error(
|
||||
"existing_odoo_address_id", _("Please select an existing address.")
|
||||
"existing_odoo_address_id", _("Please select an invoice address.")
|
||||
)
|
||||
return cleaned_data
|
||||
|
|
|
@ -17,16 +17,16 @@
|
|||
{{ form.billing_processing_choice.as_field_group }}
|
||||
<div id="existing_billing_address_section" class="mt-3">{{ form.existing_odoo_address_id.as_field_group }}</div>
|
||||
<div id="new_billing_address_section" class="mt-3">
|
||||
{{ form.ba_name.as_field_group }}
|
||||
{{ form.ba_street.as_field_group }}
|
||||
{{ form.ba_street2.as_field_group }}
|
||||
{{ form.ba_city.as_field_group }}
|
||||
{{ form.ba_zip.as_field_group }}
|
||||
{{ form.ba_state_name.as_field_group }}
|
||||
{{ form.ba_country_name.as_field_group }}
|
||||
{{ form.ba_email.as_field_group }}
|
||||
{{ form.ba_phone.as_field_group }}
|
||||
{{ form.ba_vat.as_field_group }}
|
||||
{{ form.invoice_name.as_field_group }}
|
||||
{{ form.invoice_street.as_field_group }}
|
||||
{{ form.invoice_street2.as_field_group }}
|
||||
{{ form.invoice_city.as_field_group }}
|
||||
{{ form.invoice_zip.as_field_group }}
|
||||
{{ form.invoice_state_name.as_field_group }}
|
||||
{{ form.invoice_country.as_field_group }}
|
||||
{{ form.invoice_email.as_field_group }}
|
||||
{{ form.invoice_phone.as_field_group }}
|
||||
{{ form.invoice_vat.as_field_group }}
|
||||
</div>
|
||||
<div class="col-sm-12 d-flex justify-content-end">
|
||||
<button class="btn btn-primary me-1 mb-1" type="submit">{% translate "Create Organization" %}</button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue