Hide billing addresses #281
3 changed files with 95 additions and 62 deletions
|
|
@ -86,7 +86,13 @@ class BillingEntityAdmin(admin.ModelAdmin):
|
|||
|
||||
@admin.register(OrganizationOrigin)
|
||||
class OrganizationOriginAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "billing_entity", "default_odoo_sale_order_id")
|
||||
list_display = (
|
||||
"name",
|
||||
"billing_entity",
|
||||
"default_odoo_sale_order_id",
|
||||
"hide_billing_address",
|
||||
)
|
||||
list_filter = ("hide_billing_address",)
|
||||
search_fields = ("name",)
|
||||
autocomplete_fields = ("billing_entity",)
|
||||
filter_horizontal = ("limit_cloudproviders",)
|
||||
|
|
|
|||
|
|
@ -419,6 +419,20 @@ class OrganizationOrigin(ServalaModelMixin, models.Model):
|
|||
"If set, this sale order will be used for new organizations with this origin."
|
||||
),
|
||||
)
|
||||
hide_billing_address = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name=_("Hide Billing Address"),
|
||||
help_text=_(
|
||||
"If enabled, the billing address will not be shown in the organization details view."
|
||||
),
|
||||
)
|
||||
billing_message = models.TextField(
|
||||
blank=True,
|
||||
verbose_name=_("Billing Message"),
|
||||
help_text=_(
|
||||
"Optional message to display instead of billing address (e.g., 'You will be invoiced by Exoscale')."
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Organization origin")
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if not form.instance.origin.hide_billing_address %}
|
||||
{% if form.instance.billing_entity and form.instance.billing_entity.odoo_data.invoice_address %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
|
|
@ -226,6 +227,18 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% elif form.instance.origin.billing_message %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">{% translate "Billing Information" %}</h4>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<p>{{ form.instance.origin.billing_message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if can_manage_members %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue