Skip to content

Cost Center or Dimension support #302

@ay1man4

Description

@ay1man4

I checked the documentation and didn't find anything related to Cost Centers or Dimensions concept.
The Entity usually have multiple branches or departments at different regions or cities, sometimes it is required to get financial reports like P&L at different levels, for example per region, branch or department.

I think it is possible by modifying the TransactionModel and add oneToMany Dimension field to it. It can be considered as tags for each transaciton that can be used later to group by single or combined tags to achieve different cost center/dimension reports.

I am thinking of adding new models for more flexibility:

class DimensionGroup(models.Model):
    """Defines the type of financial dimension (e.g., 'Region', 'Branch', 'Department')."""
    name = models.CharField(max_length=50, unique=True, help_text="e.g., Region")

    def __str__(self):
        return self.name

class Dimension(models.Model):
    """Defines a specific value within a group (e.g., 'East Region', 'Main Branch', 'Marketing')."""
    group = models.ForeignKey(DimensionGroup, on_delete=models.CASCADE, related_name='dimensions')
    name = models.CharField(max_length=100)

    def __str__(self):
        return f"{self.group.name}: {self.name}"

    class Meta:
        unique_together = ('group', 'name') # Prevents duplicate "Marketing" entries in the same group

then change transaciton abstract model:

class TransactionModelAbstract(CreateUpdateMixIn):
    dimensions = models.ManyToManyField(
            Dimension,
            blank=True,
            related_name='journal_items',
            help_text="Tag this transaction item with relevant cost centers/dimensions."
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions