Add OrganizationOrigin.invoice_grouping
This commit is contained in:
parent
d69b46ecfd
commit
8bb25a4f66
3 changed files with 57 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
# Generated by Django 5.2.9 on 2025-12-04 12:46
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("core", "0017_add_unit_and_convert_odoo_ids_to_charfield"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="organizationorigin",
|
||||
name="invoice_grouping",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("by_service", "By Service"),
|
||||
("by_organization", "By Organization"),
|
||||
],
|
||||
default="by_service",
|
||||
help_text="Determines how service instances are grouped on invoices.",
|
||||
max_length=20,
|
||||
verbose_name="Invoice Line Item Grouping",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="computeplanassignment",
|
||||
name="unit",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("hour", "Hour"),
|
||||
("day", "Day"),
|
||||
("month", "Month (30 days / 720 hours)"),
|
||||
("year", "Year"),
|
||||
],
|
||||
default="hour",
|
||||
help_text="Unit for the price (e.g., price per hour)",
|
||||
max_length=10,
|
||||
verbose_name="Billing unit",
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
from .odoo_cache import OdooObjectCache
|
||||
from .organization import (
|
||||
BillingEntity,
|
||||
InvoiceGroupingChoice,
|
||||
Organization,
|
||||
OrganizationInvitation,
|
||||
OrganizationMembership,
|
||||
|
|
@ -30,6 +31,7 @@ __all__ = [
|
|||
"ComputePlanAssignment",
|
||||
"ControlPlane",
|
||||
"ControlPlaneCRD",
|
||||
"InvoiceGroupingChoice",
|
||||
"OdooObjectCache",
|
||||
"Organization",
|
||||
"OrganizationInvitation",
|
||||
|
|
|
|||
|
|
@ -382,6 +382,11 @@ class BillingEntity(ServalaModelMixin, models.Model):
|
|||
return data
|
||||
|
||||
|
||||
class InvoiceGroupingChoice(models.TextChoices):
|
||||
BY_SERVICE = "by_service", _("By Service")
|
||||
BY_ORGANIZATION = "by_organization", _("By Organization")
|
||||
|
||||
|
||||
class OrganizationOrigin(ServalaModelMixin, models.Model):
|
||||
"""
|
||||
Every organization has an origin, though origins may be
|
||||
|
|
@ -433,6 +438,13 @@ class OrganizationOrigin(ServalaModelMixin, models.Model):
|
|||
"Optional message to display instead of billing address (e.g., 'You will be invoiced by Exoscale')."
|
||||
),
|
||||
)
|
||||
invoice_grouping = models.CharField(
|
||||
max_length=20,
|
||||
choices=InvoiceGroupingChoice.choices,
|
||||
default=InvoiceGroupingChoice.BY_SERVICE,
|
||||
verbose_name=_("Invoice Line Item Grouping"),
|
||||
help_text=_("Determines how service instances are grouped on invoices. "),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Organization origin")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue