Compare commits

..

3 commits

Author SHA1 Message Date
3e6c598c96 Fix missing invoice address choices
All checks were successful
Tests / test (push) Successful in 25s
2025-06-04 11:41:16 +02:00
0611e4677e Fix rendering of radio inputs 2025-06-04 11:41:12 +02:00
eeec053165 Remove VAT field 2025-06-04 11:07:10 +02:00
9 changed files with 33 additions and 15 deletions

View file

@ -154,8 +154,6 @@ class BillingEntity(ServalaModelMixin, models.Model):
"name": odoo_data.get("company_name", name),
"company_type": "company",
}
if vat := odoo_data.get("invoice_vat"):
company_payload["vat"] = vat
company_id = CLIENT.execute("res.partner", "create", [company_payload])
instance.odoo_company_id = company_id
@ -199,7 +197,7 @@ class BillingEntity(ServalaModelMixin, models.Model):
"invoice_address": None,
}
company_fields = ["name", "company_type", "vat"]
company_fields = ["name", "company_type"]
invoice_address_fields = [
"name",
"company_type",

View file

@ -40,7 +40,6 @@ class OrganizationCreateForm(OrganizationForm):
)
invoice_email = forms.EmailField(label=_("Billing Email"), required=False)
invoice_phone = forms.CharField(label=_("Phone"), required=False, max_length=30)
invoice_vat = forms.CharField(label=_("VAT ID"), required=False, max_length=50)
class Meta(OrganizationForm.Meta):
pass

View file

@ -20,6 +20,8 @@ class VerticalFormRenderer(TemplatesSetting):
def get_class_names(self, field):
input_type = self.get_field_input_type(field)
errors = "is-invalid " if field.errors else ""
if input_type == "radio":
return f"{errors}form-check-input"
if input_type == "checkbox":
return f"{errors}form-check-input"
return f"{errors}form-control"

View file

@ -0,0 +1,6 @@
{% include "django/forms/widgets/input.html" %}
{% if widget.wrap_label %}
<label {% if widget.attrs.id %}for="{{ widget.attrs.id }}"{% endif %}>
{% if not widget.attrs.hide_label %}{{ widget.label }}{% endif %}
</label>
{% endif %}

View file

@ -0,0 +1,15 @@
{# Change compared to Django: only render widget.attrs.class in actual option widget, not in wrapper #}
{% with id=widget.attrs.id %}
<div {% if id %}id="{{ id }}"{% endif %}>
{% for group, options, index in widget.optgroups %}
{% if group %}
<div>
<label>{{ group }}</label>
{% endif %}
{% for option in options %}
<div>{% include option.template_name with widget=option %}</div>
{% endfor %}
{% if group %}</div>{% endif %}
{% endfor %}
</div>
{% endwith %}

View file

@ -19,7 +19,7 @@
</div>
</div>
</div>
{% if form.existing_odoo_address_id and form.existing_odoo_address_id.choices %}
{% if form.billing_processing_choice %}
<div class="card">
<div class="card-content">
<div class="card-header">
@ -42,8 +42,6 @@
</div>
<div class="form-body card-body">
<div class="row">
{{ form.invoice_vat.as_field_group }}
<hr>
{{ form.invoice_street.as_field_group }}
{{ form.invoice_street2.as_field_group }}
<div class="col-md-2">{{ form.invoice_zip.as_field_group }}</div>

View file

@ -116,12 +116,6 @@
</th>
<td>{{ odoo_data.invoice_address.country_id.1|default:"" }}</td>
</tr>
<tr>
<th class="w-25">
<span class="d-flex mt-2">{% translate "VAT ID" %}</span>
</th>
<td>{{ odoo_data.company.vat|default:"" }}</td>
</tr>
<th class="w-25">
<span class="d-flex mt-2">{% translate "Invoice Email" %}</span>
</th>

View file

@ -142,11 +142,11 @@ INSTALLED_APPS = [
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
# The frontend app is loaded early in order to supersede some allauth views/behaviour
"servala.frontend",
"django.forms",
"template_partials",
"rules.apps.AutodiscoverRulesConfig",
# The frontend app is loaded early in order to supersede some allauth views/behaviour
"servala.frontend",
"allauth",
"allauth.account",
"allauth.socialaccount",

View file

@ -54,6 +54,12 @@ html[data-bs-theme="dark"] .btn-outline-primary, .btn-outline-primary {
margin-bottom: 0;
}
fieldset .form-check-input + label {
font-weight: normal;
min-height: 1.5rem;
margin: .125rem;
}
.search-form .form-body>.row {
display: flex;
&>.col-12 {